Jump to content

Search for something in a variable


aQ

Recommended Posts

Hello!

 

I have a variable ( $theProgram[name], found in a database, contains "MyProgram" ), and I have another one ($program[name], also found in a database, contains "CATEGORY: MyProgram"). I want to search for $theProgram[name] inside $program[name], and if I find it, I want to print out $program[information]. I don't know if this is possible, but help me if you can. :)

Link to comment
Share on other sites

Dont mean to be picky, but you should use the strstr() function for this as its faster.

 

You can, but the speed difference is very minute for 1 record. That and with strstr() you need to make sure you use the === false parameter.

 

Either way works, I just hate using the === operator to check false variables, they bug me.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.