Jean
Jean

Reputation: 772

What is the meaning of _r in PHP's print_r()?

I've seen this answer on so, but i'm not sure if it's the same for PHP... and if it is, what is the meaning of reentrant ?

Upvotes: 5

Views: 1148

Answers (4)

Visakh Vijayan
Visakh Vijayan

Reputation: 718

The _r stands for readable. This is visible when you display arrays in PHP. It shows a nice identation while doing so.

Upvotes: 1

Macmade
Macmade

Reputation: 53970

From the PHP manual:

print_r — Prints human-readable information about a variable

The point of print_r is that it prints infos about a variable in a human-readable way, as opposed to var_dump, for instance...

So a good guess is that the r stands for readable.

Upvotes: 4

Krimson
Krimson

Reputation: 7664

print_r will return any output is produces on the screen and produce a human readable format of an object

<?php
    $a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
    print_r ($a);
?>

Will output

Array
(
    [a] => apple
    [b] => banana
    [c] => Array
        (
            [0] => x
            [1] => y
            [2] => z
        )
)

Upvotes: 1

Jason OOO
Jason OOO

Reputation: 3552

From PHP.net:

print_r — Prints human-readable information about a variable

so the answer is "readable"

Upvotes: 10

Related Questions