Click to See Complete Forum and Search --> : php substr_count function not working?


sjcoder07
March 11th, 2008, 02:20 AM
Hello everyone:

I am doing an exercise using substr_count function. I received a warning message and I couldn't figure out what caused the error.
Please help me troubleshooting the problem and tell me what I did wrong. Thanks!


<?php

$text = "This is a test";

echo substr_count($text, 'is', 3) . "<br />"; //line8

echo substr_count($text, 'is', 3, 3) . "<br />"; //line 10
?>



Error message: Warning: Wrong parameter count for substr_count() line 8 and line 10.

PeejAvery
March 11th, 2008, 08:31 AM
Support for the last two parameters (offset and length) were not added until PHP 5.1. You need to upgrade in order to use those features.