Example #1
0
function printarray($array)
{
    if (is_object($array)) {
        return printObject($array);
    }
    if (!is_array($array)) {
        return;
    }
    while (list($key, $value) = each($array)) {
        if (is_array($value)) {
            echo $key . '(array):<blockquote>';
            printarray($value);
            //recursief!!
            echo '</blockquote>';
        } elseif (is_object($value)) {
            echo $key . '(object):<blockquote>';
            printobject($value);
            echo '</blockquote>';
        } else {
            echo $key . '==>' . $value . '<br />';
        }
    }
}
Example #2
0
function printarray($array)
{
    if (is_object($array)) {
        return printObject($array);
    }
    if (!is_array($array)) {
        return;
    }
    while (list($key, $value) = each($array)) {
        if (is_array($value)) {
            echo $key . "(array):<blockquote>";
            printarray($value);
            //recursief!!
            echo "</blockquote>";
        } elseif (is_object($value)) {
            echo $key . "(object):<blockquote>";
            printobject($value);
            echo "</blockquote>";
        } else {
            echo $key . "==>" . $value . "<br />";
        }
    }
}
function printval($object, $index, $link = 0, $nulldisp = '&nbsp;')
{
    $data = '';
    if (isset($object[$index])) {
        if (is_array($object[$index])) {
            $data .= printarray($object, $index, $link = 0, $nulldisp = '&nbsp;');
        } else {
            $data .= getlookup($object[$index]);
            if ($link) {
                $data = "<a href='#{$object[$index]}'>{$data}</a>";
            }
        }
    } else {
        $data .= $nulldisp;
    }
    return $data;
}
Example #4
0
function dumparray($a)
{
    // provide a debugging output similar to var_dump, without breaking execution
    if (!is_array($a)) {
        return false;
    }
    $output = " Array(";
    foreach ($a as $key => $value) {
        if (is_array($value)) {
            $output .= "<br>[{$key}] => <br>" . printarray($value);
        } else {
            $output .= "'{$key}' => '{$value}'<br>";
        }
    }
    $output .= ") <br>";
    return $output;
}
<?php

function printarray(array $x)
{
    echo "<pre>";
    print_r($x);
    echo "</pre>";
}
$a = array(1, 2, 3, 4, 5, 6, 7);
printarray($a);