Weired error message (I think)

I was wondering if someone could tell me what is causing the warning message: “[30-Jun-2012 18:12:37] PHP Warning: Wrong parameter count for strstr() in /Users/cliffgs/Sites/artworks.dev/includes/sortSession.php on line 9”

<?php
if(!isset($_SESSION['country'])) {
    $_SESSION['country'] = '21*New Zealand';
}
if (isset($_POST['country'])) {
    $_SESSION['country'] = $link -> real_escape_string($_POST['country']);
}
$regionCountry = $_SESSION['country'];
$foundRegion = strstr($regionCountry, '*', true);
$foundCountry = ltrim(strstr($regionCountry, '*'), '*');
?>

After a lifetime working in graphic design on computers, I have found that when a computer gives an error message, it usually turns out to be correct, not matter how many times I swear at it.

But for the life of me I cannot see what is causing the above Warning. On the same topic, should I worry as it is only a warning?

Many thanks

What version of PHP are you using? According to the change log in the manual for that function the third parameter was added to the function in php version 5.3.0, PHP versions prior to that only accept two parameters for that function, 1 being the “needle” being looked for the other being the “haystack” that is being searched for the the “needle”.

Thanks for the reply SpacePhoenix.

I am using MAMP on my local machine, and it says the version of PHP is 5.2.17.

So that explains that. I would/could change to 5.3, but on my live server the php version is only 5.2.14, so that wouldn’t work. I guess I have to do a rtrim as well.

Where do I find this changelog?

http://uk.php.net/manual/en/function.strstr.php

Scroll down for it. You can download from the php.net site a CHTML version of the manual which you can search offline

Terrific! Thanks very much.

Sitepoint Forums Rock!!