Source for file ArrayTools.php
Documentation is available at ArrayTools.php
- 1: <?php
- 3: /**
- 4: * Nette Framework
- 5: *
- 6: * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
- 7: *
- 8: * This source file is subject to the "Nette license" that is bundled
- 9: * with this package in the file license.txt.
- 10: *
- 11: * For more information please see http://nettephp.com
- 12: *
- 18: */
- 22: /**
- 23: * Array tools library.
- 24: *
- 28: */
- 30: {
- 32: /**
- 33: * Static class - cannot be instantiated.
- 34: */
- 36: {
- 38: }
- 42: /**
- 43: * Returns array item or $default if item is not set.
- 44: * Example: $val = ArrayTools::get($arr, 'i', 123);
- 49: */
- 51: {
- 57: }
- 58: }
- 60: }
- 64: /**
- 65: * Returns reference to array item or $default if item is not set.
- 69: */
- 71: {
- 77: }
- 78: }
- 80: }
- 84: /**
- 85: * Recursively appends elements of remaining keys from the second array to the first.
- 89: */
- 91: {
- 96: }
- 97: }
- 99: }
- 103: /**
- 104: * Searches the array for a given key and returns the offset if successful.
- 108: */
- 110: {
- 113: }
- 117: /**
- 118: * Inserts new array before item specified by key.
- 123: */
- 125: {
- 127: $arr = array_slice($arr, 0, $offset, TRUE) + $inserted + array_slice($arr, $offset, NULL, TRUE);
- 132: /**
- 133: * Inserts new array after item specified by key.
- 138: */
- 140: {
- 143: $arr = array_slice($arr, 0, $offset, TRUE) + $inserted + array_slice($arr, $offset, NULL, TRUE);
- 146: }