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 = NArrayTools::get($arr, 'i', 123);
- 49: */
- 51: {
- 58: }
- 59: }
- 64: }
- 65: }
- 69: /**
- 70: * Recursively appends elements of remaining keys from the second array to the first.
- 74: */
- 76: {
- 81: }
- 82: }
- 84: }
- 88: /**
- 89: * Searches the array for a given key and returns the offset if successful.
- 93: */
- 95: {
- 98: }
- 102: /**
- 103: * Inserts new array before item specified by key.
- 108: */
- 110: {
- 112: $arr = array_slice($arr, 0, $offset, TRUE) + $inserted + array_slice($arr, $offset, NULL, TRUE);
- 117: /**
- 118: * Inserts new array after item specified by key.
- 123: */
- 125: {
- 128: $arr = array_slice($arr, 0, $offset, TRUE) + $inserted + array_slice($arr, $offset, NULL, TRUE);
- 131: }