Jump to content

access to php 5.3 function features on older installs (strstr)


fivestringsurf

Recommended Posts

I wrote some functions that work great locally - I have php5.3 installed.  Upon uploading to my godaddy server things broke, as godaddy's server is currently running 5.2.5.  my functions rely heavily upon the 3rd paramater of strstr() which is 5.3  and older feature.

 

Is there a way i can simply copy php5.3's strstr() function and include() it as a regular custom function so i can access strstr()'s 3rd parameter while using php5.2?

Is there a way i can simply copy php5.3's strstr() function and include() it as a regular custom function so i can access strstr()'s 3rd parameter while using php5.2?

 

No. You will need to upgrade or write your own version (named something else of course).

upgrading is not an option, because the site is hosted at godaddy.  but i actually did write my own function to emulate strstr('this','that',true);    //set to true to capture data prior to needle:

 

function myStrstrTrue($haystack,$needle){  //strstr() 3rd parameter is php5.3<=  so i wrote this
$haystack = (string)$haystack;
$haystack = explode($needle,$haystack); //remove text after end tag and tag
$haystack =  (string)$haystack[0];
return $haystack;
}

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.