php - Foreach is Skipping all row util the last one -


i have little script created own fun. ( don't ask purpose )

ini_set('memory_limit','1024m'); include("postalcodear.php"); $multidimensionar['k'][0]['a'][1]['m'][0] = "on"; echo count($postalcodearray)."\n"; foreach($postalcodearray $postal => $code); {     echo $postal."\n";     $postal = strtoupper($postal);     $multidimensionar[$postal{0}][$postal{1}][$postal{2}][$postal{3}][$postal{4}][$postal{5}] = $code; } 

and in file postalcodear.php there very big array postalcode , it' s province code.

the output im getting

916760 t1s0k6 

t1s0k6 last 1 in array in file postalcodear.php

so technically if function count() correctly outputing correct amount of row why foreach not running through them all?

it shouldn't semicolon after foreach.

foreach executes block or statement multiple times. semicolon gives empty statement, , block ignored. due nature or phps foreach iteration variables still in scope after last iteration, that's why 1 row echoed.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -