Preg_replace problems, asking for help
$wupin = "A category 0:::::: Name 1:::::: Brand/Manufacturer 2:::::" Specifications 3 ":":.: "Number of the changes to be changed 4::::: Unit 5::::: £ º 6:; B Category 0:::::: Product 1:::::: Brand/Manufacturer 2:::::: Specification 3:::.... number of the changes 4::::: Unit 5::::: 6;
$strrpos _start= "a category 0:::::: Product 1:::::: Brand/Manufacturer 2::::: Specifications 3::::::";//Query previous section
$strrpos _end= "Unit 5:::.:: Unit Price 6::::::";//Query later section
$k = $strrpos _start;
$n = 10;
echo Preg_replace ("/(<= $k) \d+/e", ' 0 + '. $n, $wupin);//not working, error
?>
I want to add 10 to the number of "changes in the number 4" in Category A.
------to solve the idea----------------------
$wupin = "A category 0:::::: Name 1:::::: Brand/Vendor 2::::": "Specifications 3":::.: "Number of Changes 4::::: Unit 5:::::: +/-/------:
------to solve the idea----------------------
B Category 0:::::: Product 1:::::: Brand/Manufacturer 2:::::: Specification 3:::.... number of the changes 4::::: Unit 5::::: 6;
$ep = Explode ('
------to solve the idea----------------------
', $wupin);
if ($ep [0][0] = = ' A ') {
$EP [0] = Preg_replace_callback ("/(number to be changed) (\d)/", Create_function (' $matches ', ' return $matches [1]. ( $matches [2]+10]; '), $ep [0]);
}
echo Join ($EP);