I know this easy but I still can't solve it, I have this piece of code :
$names = [
'1' => 'name1',
'2' => 'name2',
'3' => 'name3',
];
It's simple for small number array, but how if i get many data and always change?, I plan to use for loop
$totaldata = 5
for($z=1; $z<=$totaldata; $z++) {
$yz = name.$z;
$names = [
$z => $yz,
];
}
but somehow it doesn't work, any solution?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire