Welcome Guest, Not a member yet? Register   Sign In
Message: Wrong parameter count for preg_replace()
#1

[eluser]Unknown[/eluser]
I found a Google result on a Drupal topic regarding this error, but nothing in respect to Codeigniter. This expression pulls no errors in a non-CI instance, but gets errors thrown a few times in CI (it's a loop). It still outputs the right array...what is the issue?

Message: Wrong parameter count for preg_replace() for ->this line


Code:
$regexp="<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>(.*)<\/a>";
    preg_match_all("/$regexp/siU", $input, $matches);
    //echo "Preg Match Links";
    //print_r($matches[0]);
    //echo "<br/><br/>";

    $outputArray=array();
    $postID=array();
    $i=0;
             foreach ($matches[0] as $key=>$value):
               $stripped[$i] = preg_replace($matches[0][$i]);
->this line    preg_match("/$regexp/siU", $value, $outputArray);
....
#2

[eluser]Federico BaƱa[/eluser]
I can only think of $value being empty.

EDIT:

The third parameter is the string or array of strings where to look, you're there putting an empty array. That may be the issue.

http://php.net/manual/en/function.preg-replace.php

also I read around that it has something related to the PHP version you're on, not sure
#3

[eluser]pickupman[/eluser]
You are missing 2nd and 3rd parameters
preg_replace ( mixed $pattern , mixed $replacement , mixed $subject);




Theme © iAndrew 2016 - Forum software by © MyBB