Are there any potential issues or limitations when using print_r with the second parameter set to true in PHP versions prior to 4.3.0?

When using print_r with the second parameter set to true in PHP versions prior to 4.3.0, the output may not be as expected or may cause errors. To solve this issue, you can create a custom function that recursively traverses the array and formats the output correctly.

function custom_print_r($array) {
    echo "<pre>";
    foreach ($array as $key => $value) {
        if (is_array($value)) {
            echo "$key: ";
            custom_print_r($value);
        } else {
            echo "$key: $value\n";
        }
    }
    echo "</pre>";
}

$array = array("a" => 1, "b" => array("c" => 2, "d" => 3));
custom_print_r($array);