I have this foreach here
<?php foreach($division as $value){
$arraydivision[] = $value['name'];
} ?>
but the keys come back as 0, 1, 2, 3, 4
I would like the keys to be also the names…I have tried
<?php foreach($division as $value){
$arraydivision[] = $value['name'] => $value['name'];
} ?>
But that didnt work, just gave me an error…anyone know why this is not working?
The PHP syntax for this is:
Take a look at PHP array documentation, section
Creating/modifying with square bracket syntax, there are also exmpales on how to useunset()and other details.You also may find documentation for
foreachinteresting (especially secion onarray_expression as $key => $valuesyntax).