0
I have the following array:
array(3) {
[0]=>
string(22) "VALOR 1"
[1]=>
string(10) "VALOR 2"
[2]=>
string(14) "VALOR 3"
}
I need to show all the values of this array but delete the first one, which in this case is "VALUE 1". How to remove the first value from the array? The string can be anything.
I tried to use the array_shift() but it ends up disappearing with my array and leaving only the first string.
Do not understand, you want to remove the element or not? o
array_shift()
removes the first element.– rray
@rray, I need to maintain an array but without the value [0]
– haykou
You need to keep the key (
0
) empty, would that be?– rray
@rray, that, key 0 with for example only " ".
– haykou
Is the array always numerical? the zero key is always the first?
– rray
a 0 is always the first yes, I need to show all strings inside the array, except the first string
– haykou
$arr = array('valor 1', 'valor 2', 'valor 3');
if(!empty($arr[0])) $arr[0] = '';
this server code or has some problem?– rray
@Rray, this is it
– haykou
It would not be enough just to set the first array as empty?
$arr[0] = null;
– Daniel Omine