Convert Boolean to String

  $BooleanValue = $MyBoolVariable ? 1 : 0;
  //or
  $BooleanString = $MyBoolVariable ? 'true' : 'false';

Convert Boolean Text To Boolean

Strings always evaluate to boolean true unless they have a value that’s considered “empty” by PHP.  FILTER_VALIDATE_BOOLEAN provides a solution though:

	$UploadsEnabled = "false";
	$UploadsEnabled = filter_var($UploadsEnabled, FILTER_VALIDATE_BOOLEAN);

Convert Bytes To UInt32

	$handle = fopen("myfile.bin", "rb");
	$Contents = fread($handle, 20); 
	$FileByteArray = unpack("C*",$Contents); 				//<<<Warning the outputted array starts from [1] not [0] !!!!!! Bloody PHP...
	$ByteCount = 1;			//<Yes 1 not 0
	//Get uint32_t value from block of 4 bytes
	$SerialNumber = $FileByteArray[$ByteCount++] << 24;
	$SerialNumber += $FileByteArray[$ByteCount++] << 16;
	$SerialNumber += $FileByteArray[$ByteCount++] << 8;
	$SerialNumber += $FileByteArray[$ByteCount++];