hexdump()


int hexdump ( string $str [ ,int $start=0, int $len=256 ] )

Description

hexdump() dumps a binary data stream into a human-friendly format to the standard output.

※ available F/W version : all

Parameters

Return values

Returns the length of output data, PHP error on error

Example

<?php
$str = "Hello PHPoC";
hexdump($str);  
// OUTPUT: 0000  48 65 6c 6c 6f 20 50 48  50 6f 43               |Hello PHPoC     |
hexdump($str, 1, 3);  
// OUTPUT: 0001  65 6c 6c                                        |ell             |
hexdump($str, -5, 3); 
// OUTPUT: 0006  50 48 50                                        |PHP             |
?>

Use the following code if the input data length is over the maximum length:

<?php
function hexdump1024($str)
{
for($offset = 0; $offset < strlen($str); )
        $offset += hexdump($str, $offset);
return $offset;
}
?>

See also

None

Remarks

None