Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6695555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:14:08+00:00 2026-05-26T06:14:08+00:00

I found and adapted an example which scans an array for an entry like

  • 0

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:

  1. Is using the above array creation syntax incorrect?
  2. How can I properly create these two arrays so that they can be merged?

Thanks!
d

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:14:09+00:00Added an answer on May 26, 2026 at 6:14 am

    Your arrays aren’t “valueless”, they are just numeric arrays. The values are the strings ('svn', 'fla', etc.).

    The PHP docs for array_merge says:

    Values in the input array with numeric keys will be renumbered with incrementing keys starting from zero in the result array.

    The syntax you posted…

    <?php
    
    $ignoredFileTypes = array('svn','fla','bak','db');
    $customIgnoredFileTypes = array('txt', 'xsd');
    $ignoredFileTypes = array_merge( $ignoredFileTypes , $customIgnoredFileTypes );
    print_r($ignoredFileTypes);
    

    Works perfectly for me:

    Array
    (
        [0] => svn
        [1] => fla
        [2] => bak
        [3] => db
        [4] => txt
        [5] => xsd
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So: I have the following function, adapted from a formula found online, which takes
I've adapted this from an example that I found on the 'net... function ratio($a,
I have found this example Lazy load of images in ListView from Fedor which
Basically my problem is that i've adapted a piece of code found here http://social.msdn.microsoft.com/Forums/en-US/vemapcontroldev/thread/62e70670-f306-4bb7-8684-549979af91c1
I've run into a problem which seems troubling to me. It seems I've found
I found here a topic about an MySQL IF, ELSE query,i adapted it but
I'v followed the following example , and it works like charm: CKeditor for jquery
I'm using the python-openid library from Janrain at http://openidenabled.com/python-openid/ I adapted their Django example
Found some old code, circa VS 2003. Now I have just VS 2008 (SP1)
Found the following in an Oracle-based application that we're migrating (generalized) : SELECT Table1.Category1,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.