Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $GLOBALS['taskary'] = array(1 => 1,2,3,4,5);
- echo "12345 - expected" . PHP_EOL;
- reset($GLOBALS['taskary']);
- while ($next = each($GLOBALS['taskary'])) {
- $val = $next['value'];
- echo $val;
- if ($val == 2) {
- unset($GLOBALS['taskary'][2]);
- }
- }
- echo PHP_EOL;
- $GLOBALS['taskary'] = array(1 => 1,2,3,4,5);
- // ----
- echo "1245 - expected" . PHP_EOL;
- reset($GLOBALS['taskary']);
- while ($next = each($GLOBALS['taskary'])) {
- $val = $next['value'];
- echo $val;
- if ($val == 2) {
- unset($GLOBALS['taskary'][3]);
- }
- }
- echo PHP_EOL;
- // ----
- $GLOBALS['taskary'] = array(1 => 1,2,3,4,5);
- echo "12345 - expected" . PHP_EOL;
- reset($GLOBALS['taskary']);
- do {
- $val = current($GLOBALS['taskary']);
- echo $val;
- if ($val == 2) {
- unset($GLOBALS['taskary'][2]);
- }
- } while (next($GLOBALS['taskary']) !== false);
- echo PHP_EOL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement