NOVINKA: Najžiadanejšie rekvalifikačné kurzy teraz s 50% zľavou + kurz AI ZADARMO. Nečakaj, táto ponuka dlho nevydrží! Zisti viac:

PHP - print_r

Trieda

Koreň \ Bez triedy

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ázovDátový typPredvolená hodnotaPopis
$expressionmixed

The variable to be printed.

$returnbool 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
      Aktivity