Reputation: 833
I am receiving binary data with socket_recv function. Is there some way in php to merge them into one so I can still work with them as with binary strings?
Upvotes: 3
Views: 3841
Reputation: 287885
You can simply concatenate arbitrary strings with the .
operator:
<?php
$s = "a\0b" . "c\0d";
var_export($s); // outputs 'a' . "\0" . 'bc' . "\0" . 'd'
Upvotes: 6