title: Converting bytes retrieved over a php socket to a integer
body: <p>I am using the netty API to create a Java server which sends if a client programm sends anything to the server a number like 5. It is a integer with 4 bytes. I think it should be the same like writing an integer into an OutputStream. So I want to receive the integer now by php. But if I call socket_read it outputs nothing helpfull because it does not convert the 4 bytes into a integer. It just uses this as text. </p>
  
  <p>If I send a char it works so I need a way in php to convert it.</p>
  
  <p>Or would it be the best to convert all into text clientside, so all is text-based.
  I think maybe I have to stick with a text-based or binary output.</p>
  
  <p>EDIT: Another question related to this is, let's say I have 4 bytes in java. How can I build a Integer? Do I have to concat the 4 bytes? </p>
  
  <p>Example:</p>
  
  <p>Byte 1: 00000000 </p>
  
  <p>Byte 2: 00010000 </p>
  
  <p>Byte 3: 00000101 </p>
  
  <p>Byte 4: 00000001</p>
  
  <p>Result: 00000000 00010000 00000101 00000001</p>
  
  <p>Would this be correct?</p>