regex - preg_replace to replace the number in substring php -
i have below string
$string = 'id="0000001" did="659" interval="2" media.jpg'
i want replace 2 (value dynamic 0 1000) in interval tag 0. how can it?
i tried following code replaces all
$returnvalue = preg_replace('/\\d+/', '0', $string, -1, $count);
$returnvalue = preg_replace('/(?<=interval=")\\d+/', '0', $string, -1, $count);
just include lookbehind
stating interval="
should present before \\d+
trying find.
Comments
Post a Comment