Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Shift an element off the beginning of array
<?php array_shift(array &$array): mixed
<?php {
$segments = explode('.', $key);
$first = array_shift($segments);
if (! isset($array[$first])) {
return value($default);
<?php public function updating($name, $value)
{
PHPUnit::assertEquals(array_shift($this->expected['updating']), [$name => $value]);
$this->lifecycles['updating'] = true;
}
<?php public function updated($name, $value)
{
PHPUnit::assertEquals(array_shift($this->expected['updated']), [$name => $value]);
$this->lifecycles['updated'] = true;
}
<?php public function updatingFoo($value)
{
PHPUnit::assertEquals(array_shift($this->expected['updatingFoo']), $value);
$this->lifecycles['updatingFoo'] = true;
}
<?php public function updatedFoo($value)
{
PHPUnit::assertEquals(array_shift($this->expected['updatedFoo']), $value);
$this->lifecycles['updatedFoo'] = true;
}
<?php public function updatingBar($value, $key)
{
$expected = array_shift($this->expected['updatingBar']);
$expected_key = array_keys($expected)[0];
$expected_value = $expected[$expected_key];
[$before, $after] = $expected_value;
<?php public function updatedBar($value, $key)
{
$expected = array_shift($this->expected['updatedBar']);
$expected_key = array_keys($expected)[0];
$expected_value = $expected[$expected_key];
<?php public function updatingBarBaz($value, $key)
{
$expected = array_shift($this->expected['updatingBarBaz']);
$expected_key = array_keys($expected)[0];
$expected_value = $expected[$expected_key];
[$before, $after] = $expected_value;
<?php public function updatedBarBaz($value, $key)
{
$expected = array_shift($this->expected['updatedBarBaz']);
$expected_key = array_keys($expected)[0];
$expected_value = $expected[$expected_key];
<?php $components = (array) $components;
$firstComponent = array_shift($components);
$id = 'a'.str()->random(10);
<?php $components = is_array($components) ? $components : [$components];
$firstComponent = array_shift($components);
$components = [$id => $firstComponent, ...$components];
<?php static function normalizeAndRegisterComponentName($name)
{
if (is_array($otherComponents = $name)) {
$name = array_shift($otherComponents);
foreach ($otherComponents as $key => $value) {
if (is_numeric($key)) {
<?php {
$segments = explode('.', $path);
$property = array_shift($segments);
$finish = trigger('update', $component, $path, $value);
<?php {
$segments = explode('.', $path);
$first = array_shift($segments);
[$data, $meta] = Utils::isSyntheticTuple($raw) ? $raw : [$raw, null];
<?php public function updating($name, $value)
{
PHPUnit::assertEquals(array_shift($this->expected['updating']), [$name => $value]);
$this->lifecycles['updating'] = true;
}