Reputation: 2293
Im trying to match the array value. how can i match the below code ?
$os = array("CATEGORY=OS", "SYSTEM_NAME like '%A001%'", "CATEGORY=DB");
if (in_array("CATEGORY", $os)) {
echo "Got it";
}
I need to match the CATEGORY
in array how can i do that ?
Edit 2
where (CATEGORY = 'OS' AND SYSTEM_NAME like '%A001%' AND CATEGORY = 'DB' AND SYSTEM_NAME like '%A001%')
I have query something like this i need to replace the AND
as OR
before category occrence
Expected Output
where (CATEGORY = 'OS' AND SYSTEM_NAME like '%A001%' OR CATEGORY = 'DB' AND SYSTEM_NAME like '%A001%')
Upvotes: 0
Views: 38
Reputation: 3658
use this preg_grep() php function
$os = array("CATEGORY=OS", "SYSTEM_NAME like '%A001%'", "CATEGORY=DB");
if (preg_grep("/CATEGORY/", $os)) {
echo "Got it";
}
For more reference see this
Upvotes: 1