I have the following function:
function MyReplaceListTag($myText,$number){
if (strpos($myText,'<li>')===FALSE){
$myResult= strip_tags($myText);
return $myResult;
}else{
$number++;
$pattern= '/<li>/';
$replacement = "\n".$number."- ";
$myText=preg_replace ( $pattern , $replacement , $myText , 1 );
MyReplaceListTag($myText,$number);
}
}
I call it with:
$result = MyReplaceListTag( $testTEXT,0);
Nothing is returned, var_dump($result) gives NULL.
I must be doing something incredibly stupid, but what?
$myTextthat contains<li>then the function doesn't return anything (you don't have a return statement in the else block or at the bottom), which PHP treats as NULL return