|
|
|
An undocumented feature of PHP3 (that probably nobody knows about) is that
the plus operator merges arrays. That is,
$array = $array1+$array2;
will cause $array to be the merge of the two arrays, $array1 and $array2.
Now, important notes:
1. It's undocumented, but unlike tons of other things in PHP3 that aren't
documented, it's undocumented for a reason. There's a good chance this
behavior will be dropped or changed in the future.
2. If you do decide to take your chances and use it, pay attention to the
fact it probably doesn't do what you want. The result is a merge of the
two arrays, which means that each index in each of the two arrays is copied
to the same index in the result array (if both arrays have an identical
index, the right one overrides the left one).
Changing the behavior of the operators for arrays isn't difficult, if we
ever decide what action we want them to do, if any.
|
|
| PHP Script to find url links in a page Categories : PHP, URLs, Regexps, Arrays | | | Tag content retrieval from websites with preg_match Categories : PHP, Regexps, Arrays, HTML and PHP | | | Array values from javascript to php Categories : PHP, Java Script, Arrays | | | clearing variables in php3 Categories : Variables, Arrays, PHP | | | Weighted Random - Random Scripts usually chose one out of each item, and each item have an equal chance to be chosen. But what if you want an item to be chosed more frequently than other? Categories : PHP, Math., Arrays | | | Display list of files within current and subdirectories (recursively) showing
each file as an anchored link and each directory as a category header. Categories : Filesystem, Directories, Arrays, PHP | | | Array Insertion Categories : PHP, PHP Classes, Arrays | | | Check for functional file links (broken Files)
Categories : PHP, Data Validation, FTP, Regexps, Arrays | | | Single-file PHP news system with automatic folder structure creation Categories : PHP, Filesystem, Arrays | | | This gets the http response headers for a given url and returns them in an assoc array. i.e. to test if a url exists: $array = get_http_headers($url); if($array[result]=200) { } Categories : HTTP, Arrays, PHP | | | Beginners Array Functions Categories : PHP, Beginner Guides, Arrays | | | How to pass an array from one PHP Script to another via an HTML form Categories : PHP, HTML and PHP, Arrays | | | How to load a query result into a PHP Array Categories : PHP, Databases, Arrays, MySQL | | | dynamic table columns Categories : PHP, HTML and PHP, Arrays, Databases, MySQL | | | A recursive function to traverse a multi-dimensional array where the
dimensions are not known Categories : Arrays, PHP, Algorithms | |
|
|
|