Printing the contents of a PHP Array Skriva ut innehållet i ett PHP Array
This is a pretty common task, but it's surprising how many PHP newbies don't know about it yet. Detta är en ganska gemensam uppgift, men det är förvånande hur många PHP nybörjare inte vet om det än. If you want to see the structure of your PHP Array, all you need to do is this: Om du vill se strukturen på din PHP Array, allt du behöver göra är detta:
print_r($myarray); print_r ($ MyArray);
This will give you a listing of all the items in the array, including multi-dimensional arrays. Detta kommer att ge dig en lista över alla objekt i kedjan, inklusive flerdimensionella arrayer. Obviously this should only be used for testing / debugging purposes. Självklart gäller detta bör endast användas för att testa / felsöka.

Daily Email Updates Dagligt Updates
You can get our how-to articles in your inbox each day for free. Du kan få våra instruktioner artiklar i din inkorg varje dag gratis. Just enter your name and email below: Skriv bara in ditt namn och e-postadress nedan:



and if you like it human-readable: och om du gillar det läsbara:
echo “”; print_r($myarray); echo “”; echo ""; print_r ($ MyArray) echo "";
have fun! have fun!
this is more human-readable : detta är mer läsbara:
echo ”; echo ";
print_r($array); print_r ($ array);
echo ”; echo ";
You may want to try this: Du kanske vill prova detta:
echo “”; echo "";
print_r($location); print_r ($ location);
echo “”; echo "";
echo “(html open tag)pre(html close tag)”; echo "(html öppen tag) före (html tagg)";
print_r($location); print_r ($ location);
echo “\”; echo "\";
echo “(less than sign)pre(greater than sign)”; echo "(mindre än-tecken) före (större än-tecken)";
print_r($location); print_r ($ location);
echo “(less than sign)/pre(greather than sign)”; echo "(mindre än-tecken) / pre (greather än-tecken)";
between the quotes are the html pre tags (open and then close). mellan citationstecknen är html pre taggar (öppna och stäng sedan).