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

  • Home
  • SEARCH
  • 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 9282717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T18:26:46+00:00 2026-06-18T18:26:46+00:00

I have this for a var_dump($productId) : string(1) 9 string(2) 11 string(2) 12 string(2)

  • 0

I have this for a var_dump($productId):

string(1) "9"

string(2) "11"

string(2) "12"

string(2) "17"

string(2) "18"

Now, i want for example the function_x to not execute for id 18 and 17, so i want to make something like this:

$test=array('18','17');
if(!in_array($test,array($productId))){}

but seems not to be working, the idea is if i want to make for just 18 then:

$test=18;
if($test != $productId){}

and this is working, but how to do it for more than one number/ID ?

Thanks in advance!

  • 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-06-18T18:26:47+00:00Added an answer on June 18, 2026 at 6:26 pm

    I think the other answers are assuming your $productId is an array. I’m guessing you are running var_dump() inside a foreach or something.

    if(17 != $productId && 18 != $productId)
    {
        // If $productId is not 17 and is not 18.
    }
    
    // Alternatively, if you want to add more IDs to ignore, you could use in_array.
    $ignore = array(17,18,19,20);
    
    if(false == in_array($productId,$ignore))
    {
        // If $productId is not in the ignore array.
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a query that reads like this: $fields = Doctrine_Core::getTable('model_1')->findByColumnId($id); took a var_dump
so i have this XML: the result of var_dump string ' <?xml version=1.0 encoding=UTF-8
i have this array $immagini = array('1.jpg','2.jpg','3.jpg','4.jpg'); if i make var_dump($immagini) return this array(4)
i have this two lines: var_dump($parametros_post_signin); $this->redirect('prueba/aux?email='.$parametros_post_signin['signin']); the first one prints this: array 'signin'
I have this code $vad = 1.1; print gettype($vad); var_dump($vad); this will output: double
i have this code $test = new test(); $test->var_test = array('one','two'); class test{ var
I have this code which calculates the sum of "letter numbers" in a string,
i have this code: <?php var_dump(strpos($url, cashgold.)+9) ?> <?php var_dump(strpos($url, '/', 8)) ?> <?php
I have this code: function makeUser() { $info['cn'] = Test User; $info['sn'] = User;
I have this array called $addon_array , that when i use var_dump shows up

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.