tags:

views:

265

answers:

5

Hi, I'm working on a small ajax application and need to see if the values being generated in the background are what is expected. The value returned by the quest can be quite a complex multidimensional array, is there a way to convert this into a string so that it can be shown with alert?

Is there any other way of seeing these values?

Any advice appreciated.

Thanks.

+9  A: 

print_r, var_dump or var_export are good candidates

knittl
+3  A: 

If you want to show it with javascript, I would recommend json_encode(), everything else has been covered by knittl's answer.

soulmerge
A: 

The implode command returns an array as a string.

_J_
+2  A: 
<script type="text/javascript">
alert(<?=print_r($array)?>);
</script>
mnml
A: 

you can also consider FirePHP http://www.firephp.org

stereofrog