0

I need to get the substring before needle, so according to the PHP manual the function strstr should work for me, however from some reasons it does not

$page = strstr($page2, $prod_close, true);

The function without third argument is working fine. Debuging with the Eclipse I am getting the warning: "Wrong parameter count for strstr()". I know that the full strstr functionality is available only from version 5.3 - I triple-checked php on my server which is 5.3.27. So, what is wrong here?

For the time being I am using substr instead:

$page = substr($page2, 0, strpos($page2,$prod_close);

but strstr is a little bit faster I do belive.

Rizier123
  • 58,877
  • 16
  • 101
  • 156
Dario
  • 1
  • 1
  • Please show us your full code and the exact error messages you get! Also what's your question now? – Rizier123 Jan 26 '15 at 19:28
  • 1
    _“I triple-checked php on my server which is 5.3.27”_ – please be so kind and check for a fourth time, by calling `phpinfo` in that very same script. – CBroe Jan 26 '15 at 19:31
  • Oooops, phpinfo displays 5.2.14 ??? Thanks @CBroe. Checking forth time php on the server (via Joomla admin) still presents: PHP Version 5.3.27??? – Dario Jan 26 '15 at 19:42
  • You said _“debuging with the Eclipse”_ – so that might actually not be using the same PHP version that is used when PHP files are served via the web server. Go check your Eclipse debug settings to find out which way those files are “run through” PHP when you debug from within the IDE. – CBroe Jan 26 '15 at 19:46
  • 1
    It is exactly Eclipse configuration problem. Project Default is 5.2.14, when I changed to Alternate PHP it started to work. Big thanks @CBroe – Dario Jan 26 '15 at 20:04
  • Please mind that both 5.2 and 5.3 are outdated unsupported versions of PHP ... – johannes Jan 26 '15 at 20:49

0 Answers0