stristr not working?

[php]$i = 0;
while($row = mysql_fetch_array($result, MYSQL_BOTH))
{
$data_days[$i] = $row[‘start_day’];
$i++;
}
$comma_separated = implode(",", $data_days);[/php]

When I do…

[php]if (stristr($comma_separated,‘3’) == TRUE) {
echo ‘I matched!’;
}[/php]

It works, and comes back saying “I matched!”. I even changed 3 to 1 and it didnt echo, just to be sure it was working properly.

[php]$month = $_REQUEST[“month”];
$year = $_REQUEST[“year”];

$timestamp = mktime(0, 0, 0, $month, 1, $year);[/php]

[php]$firstdow = date(“w”, $timestamp);[/php]
[php]$curday = $d - $firstdow + 1;[/php]

When I echo $curday it says 3. Which is the correct matching number in the new string that was converted to from an array.

[php]if (stristr($comma_separated,$curday) == TRUE) {
echo ‘I matched!’;
}[/php]

This does not find a 3 in the string. Why is that? I’ve been trying tons of different options, cant figure it out.

I dont see where $d is defined?

Hi there,

Just throwing it out there (not tested this), have you tried putting:
[php]if(stristr($comma_separated,(string)$curday)[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service