Debug/Show Array
4
Very useful function that you can use to debug/show your array and it's contents.
Sometimes when you have problems with arrays and print_r() isn't very nice way to show array values because it shows everything in one line and then it is very hard to debug... this way I think it's much much easier.
Sometimes when you have problems with arrays and print_r() isn't very nice way to show array values because it shows everything in one line and then it is very hard to debug... this way I think it's much much easier.
<html>
<head>
</head>
<body>
<?php
function show_array ($array) {
if(!empty($array)) {
foreach($array as $item) {
print "<pre>";
print_r($array);
print "</pre>";
}
}
}
// Usage
// Let's say that you have some multy dimension array named $array and you want to
// see what's inside that array you can use something like this
show_array($array);
?>
</body>
</html>






There are currently no comments for this snippet.