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
https://forums.phpfreaks.com/topic/58279-search-for-something-in-a-variable/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.