Funció PHP list()

Assignar variables com si fossin un array

<?php
$elmeu_array = array("Gos","Gat","Cavall");

list($a, $b, $c) = $elmeu_array;
echo "Tenc varis animals, a $a, a $b and a $c.";
?>

Quan es mostri echo sortiran les variables $a(gos), $b(gat) i $c(cavall)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.