I found and adapted an example which scans an array for an entry like so:
$ignoredFileTypes = array('svn','fla','bak','db');
if( array_search('.fla',$ignoredFileTypes) > -1 ){
return true;
}
It worked well for my initial needs.
Now, I am trying to join two arrays like so:
$ignoredFileTypes = array('svn','fla','bak','db');
$customIgnoredFileTypes = array('txt', 'xsd');
$ignoredFileTypes = array_merge( $ignoredFileTypes , $customIgnoredFileTypes );
Unfortunately, that generates a warning like so:
Warning: array_merge() [function.array-merge]: Argument #1 is not an array in C:\wamp\www\packager.php on line 41
So a couple of questions:
- Is using the above array creation syntax incorrect?
- How can I properly create these two arrays so that they can be merged?
Thanks!
d
Your arrays aren’t “valueless”, they are just numeric arrays. The values are the strings (
'svn','fla', etc.).The PHP docs for
array_mergesays:The syntax you posted…
Works perfectly for me: