At the moment I'm using strstr() for getting the first part of a string. I have my project running on 3 servers. 1. development server 2. test server 3. live server
the strstr() works fine on the development server and test server, but the moment I place my project live, the strstr prints nothing. for example:
I use this code:
//$product["titel2"] = "apple - <fruit<";
$product["titel2"]=(strstr($product["titel2"], "<domino"))?strstr($product["titel2"], "<fruit",true):$product["titel2"];
$str_product_titel = stripText(!empty($product["titel"]) && preg_match("/^<!--/",stripText($product["titel"]))==0?$product["titel"]."":$product["titel2"]);
On the first and second server I get this: apple On my 3rd server I got nothing.
Is there another way to remove the last part so I only get apple? (I don't want to do it on the "-" because there is a change that I will have other strings with multiple "-" in it. for example: apple - cake - <fruit<
(I know fruit is also written as: <fruit>, but with striptags, or striptext It wouldn't work).
So can someone help me with this little annoying problem? Thank you so much in advance!
As you can see here the last parameter of
strstr($haystack, $needle, $before_needle)
(you uses it in your first non-commented line) is available only in PHP 5.3.0+. Check your PHP version on your three setups.Anyway, you can emulate it in older PHP version using something like: