I'm having a tough time converting a value I read from socket connection into an integer. It's value tells me how many bytes are going to be received next.
$ar = fread($client, 4);
$binaryInt = unpack('N', $ar);
debug_to_console($binaryInt); //displays 16 (as expected)
$bred = fread($client, intval($binaryInt)); //intval returns 1
For some reason intval always evaluates to 1 and I can't figure out why. Btw the $ar variable is sent an integer from a java server I have running via this code sample
dOut.writeInt(data.length);
Thanks
edit
I finally got it. user2587326 below helped but instead of using intval(binaryInt[1]) it was just binaryInt[1].