Searching the proper format in php unpack function -


the output result of codes:

    $bytes= fread($handle,"32");     print_r(unpack("la/fb/fc/fd/fe/ff/fg/fh",$bytes));    array ( [a] => 20150416 [b] => 1.0499999523163 [c] => 1.25 [d] => 1.0299999713898  [e] => 1.1900000572205 [f] => 509427008 [g] => 566125248 [h] => 509427008 )  

how write proper format in unpack if wanted output following ?

array ( [1] => 20150416 [2] => 1.0499999523163 [3] => 1.25 [4] => 1.0299999713898  [5] => 1.1900000572205 [6] => 509427008 [7] => 566125248 [8] => 509427008 )  

use array_values, keeps order (first index 0):

$bytes = fread($handle,"32"); $un = unpack("la/fb/fc/fd/fe/ff/fg/fh",$bytes); print_r(array_values($un)); 

edit (if want first index 1):

$bytes = fread($handle,"32"); $un = unpack("la/fb/fc/fd/fe/ff/fg/fh",$bytes); array_unshift($un, null); $array = array_values($un); unset($array[0]); print_r($array); 

Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -