How can i change an index of an array in php? for example
$myArray = {"x","y","z","w"};
I want to change the index of myArray [2] to myArray ["two"]
How can i change an index of an array in php? for example
$myArray = {"x","y","z","w"};
I want to change the index of myArray [2] to myArray ["two"]
You could use unset()
to achieve this:
$myArray = ["x","y","z","w"];
$myArray['two'] = $myArray[2];
unset($myArray[2]);