note 118270 added to function.array-pop
| From: | Anonymous | Date: | Fri, 06 Nov 2015 16:02:41 +0000 |
| Subject: | note 118270 added to function.array-pop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204096@lists.php.net to get a copy of this message | ||
Let's "do stuff" with array_pop()
<?php
$dependecyInjection = ['globalState' => 'isHorrible'];
$workQueue = array_reverse($workQueue); // O(n)
// While we have stuff to do..... = [[ {function}, $params.... ], [], []...]
while (!empty($workQueue)) {
// O(1) : And resize array. (maybe also memory size ?)
$work = array_pop($workQueue);
// If not
muted, invoke the worker function....
if (isset($work[0])) {
$processor = array_shift($work);
if ($moreWork = $processor->__invoke($work, $dependecyInjection)) { // <== Do stuff.
// O(n) : add new stuff to the END of array ! (FIFO)
$outputCommands += array_reverse($moreWork);
}
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 217.26.96.41
----
Manual Page -- http://php.net/manual/en/function.array-pop.php
Edit -- https://master.php.net/note/edit/118270
Del: integrated -- https://master.php.net/note/delete/118270/integrated
Del: useless -- https://master.php.net/note/delete/118270/useless
Del: bad code -- https://master.php.net/note/delete/118270/bad+code
Del: spam -- https://master.php.net/note/delete/118270/spam
Del: non-english -- https://master.php.net/note/delete/118270/non-english
Del: in docs -- https://master.php.net/note/delete/118270/in+docs
Del: other reasons-- https://master.php.net/note/delete/118270
Reject -- https://master.php.net/note/reject/118270
Search -- https://master.php.net/manage/user-notes.php