“Imprimer le tableau PHP” Réponses codées

Imprimer le tableau PHP

<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
echo "<pre>";
print_r ($a);
echo "</pre>";
?>
  
Output:

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

tableau d'écho PHP

function echo_arr($arr){
        for ($i=0; $i < count($arr); $i++) { 
                echo $arr[$i];
            }
        }

echo_arr($your_array_here);
Night

tableau d'impression PHP

// raw array output
print_r($arr);

// the above well-formatted
echo '<pre>'; print_r($array); echo '</pre>';

// more details like datatype and length
var_dump($arr);

// output that PHP understands
var_export($arr);

// by foreach loop
foreach($arr as $key=>$value)
  echo $key, '=>', $value;	// $value must be convertible to string
TechNyquist

Imprimer les éléments du tableau en php

<?php $data = array('a'=>'apple','b'=>'banana','c'=>'orange');?>
<pre><?php print_r($data); ?></pre>
Enchanting Echidna

tableau d'écho PHP

foreach($results as $result) {
	echo $result . '<br>';
}
Soulless Creature

Imprimer le tableau PHP

foreach( $arrayName as $variableName ) {
    // action to perform
}
Masraga Setiawan

Réponses similaires à “Imprimer le tableau PHP”

Questions similaires à “Imprimer le tableau PHP”

Plus de réponses similaires à “Imprimer le tableau PHP” dans PHP

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code