BillyMako Posted May 21, 2009 Share Posted May 21, 2009 Hi, I have a description of a product stored in $pd = $row_mpm['products_description']; I want to find if the data in $pd contains the string "7.2V" And if found I want to set $test1 = 1; Quote Link to comment https://forums.phpfreaks.com/topic/159013-solved-find-a-string-in-this-data/ Share on other sites More sharing options...
BillyMako Posted May 21, 2009 Author Share Posted May 21, 2009 $pd = $row_mpm['products_description']; $pos = strpos($pd,"7.2V"); if($pos === false) { // string needle NOT found in haystack $test1 = 0; } else { $test1 = 1; // string needle found in haystack } Quote Link to comment https://forums.phpfreaks.com/topic/159013-solved-find-a-string-in-this-data/#findComment-838597 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.