Created
November 17, 2016 07:42
-
-
Save littlefuntik/c148539ef7b83c808de5f5a5f1b04c35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$array = new SplFixedArray(2); | |
$array[0] = 'A'; | |
$array[1] = 'B'; | |
$offset = 0; | |
if ($array->offsetExists($offset)) { | |
$sizeNew = $array->getSize() - 1; | |
for ($i = $offset; $i < $sizeNew; ++$i) { | |
$array[$offset] = $array[$offset + 1]; | |
} | |
$array->setSize($sizeNew); | |
} | |
var_dump($array->toArray()); | |
/** | |
array(1) { | |
[0] => | |
string(1) "B" | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment