PHP print_r() Funzione
❮ Riferimento alla gestione delle variabili PHP
Esempio
Stampa le informazioni su alcune variabili in un modo più leggibile:
<?php
$a = array("red", "green", "blue");
print_r($a);
echo "<br>";
$b = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");
print_r($b);
?>
Definizione e utilizzo
La funzione print_r() stampa le informazioni su una variabile in un modo più leggibile.
Sintassi
print_r(variable, return);
Valori dei parametri
Parameter | Description |
---|---|
variable | Required. Specifies the variable to return information about |
return | Optional. When set to true, this function will return the information (not print it). Default is false |
Dettagli tecnici
Valore di ritorno: | Se la variabile è intera, float o stringa, verrà stampato il valore stesso. Se la variabile è una matrice o un oggetto, questa funzione restituisce chiavi ed elementi. Se il parametro di ritorno è impostato su TRUE, questa funzione restituisce una stringa |
---|---|
Tipo di reso: | Vero o Stringa |
Versione PHP: | 4.0+ |
❮ Riferimento alla gestione delle variabili PHP