PHP - print_r
Trieda
Metóda - print_r
(PHP 4, PHP 5, PHP 7)
The print_r() function prints information about a variable in a
way it is readable by humans.
This function also prints protected and private
variables. However, static class members will not be shown.
Procedurálne
- function print_r (mixed $expression, bool $return = false) : mixed
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $expression | mixed | The variable to be printed. | |
| $return | bool | false | If we want to capture the output from the function, we have to set this parameter to TRUE. Otherwise, the function just prints the output. |
Mávratovej hodnoty
Vracia: mixed
If the second parameter is set to TRUE, the function returns an output. Otherwise, it returns TRUE.
Príklady
<?php
echo ('<pre>');
print_r(['a', 'b', 'content' =>[1, '2', true, null], 'site' => 'ICT']);
echo ('</pre>');
Súvisiace manuály
- function var_dump (mixed $expression, mixed $...) : void
