preg_replace_callback
Posted: Fri Apr 13, 2007 5:25 am
feyd | Please use
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi ,
We are facing some problem with preg_replace_callback() . This below code is running perfectly in the php 5.2.1 on redhat linx but it is not running in the feeBSD server with php5.2.1. Please help me out in this caeCode: Select all
<?php
$exp = "size {width},{height}; autoresize width; type {type},{palette},{color:{bgcolor}}; padding {padding}; color {color:{bgcolor}}; fill; color {color:{color},{alpha}}; antialias {antialias}; font {font:{font},{size},{leading}}; string {text},0,0,{width},{height},{align},{valign};" ;
function dummy($mathes)
{
return preg_replace('/([;])/', "\\\\\\\$1", $matches[0]);
}
$lines = preg_replace_callback(
'/(?<!\\\)\\\'(?:\\\\\'|[^\'])*(?:(?<!\\\)\\\')|'.
'(?<!\\\)\"(?:\\\\"|[^"])*(?:(?<!\\\)\")|'.
'(?<=\{)(?:[^{}]*(?:\{[^{}]*\})*[^{}]*)*(?=\})/',
"dummy",
$exp
);
var_dump($lines);
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]