Ho uno script php che ottiene un $_POST
per decidere quale array restituire. Es:PHP unire due nomi variabili
$n = $_POST['n']; // 1, 2 or 3
$a1 = array ('something', 'something else', 'another thing');
$a2 = array ('something 2', 'something else 2', 'another thing 2');
$a3 = array ('something 3', 'something else 3', 'another thing 3');
ora voglio ottenere la matrice che corrisponde al valore $n
, diciamo "2"
.
come posso dire echo $a . $n
per ottenere $a2
Grazie.
+1: utilizzare la matrice per memorizzare una serie di matrici è meglio che utilizzare poche variabili. – Raptor