How To View Array Contents In PHP
Computing : Learning PHP Often when debugging a PHP program it is useful to insert frequent echo statements (or print) to see what is going on. However with arrays it can be harder to get at the contents, without using a list or while or for loop or other way of iterating through. Just to see a dump however the easiest way by far is to use the print_r command with takes the array as the argument, thus: print_r($myarray); will show like this 0--> hello, 1 --> fred and so forth. Note to view it in a more print friendly format place HTML pre tags around the print_r.
![]() Questions about learn PHP:
|
|