Pretty much self explanatory what I'm trying to achieve here...
I thing that the function is getting $1 instead of the real actual string.
a tiny small tweak can make it work :)
Why it's not working ?
<?php
function mySort($arr) {
sort($arr);
return $arr;
}
$css = <<<EOF
body {
z-index : 9;
padding: 0;
margin: 0;
line-height: 10px;
}
p {
z-index: 9;
font-size: 10px;
}
h1,h2,h3,h4,h5,h6 {
z-index: 2;
padding: 0;
margin: 0;
font-size: 100%;
border: 0 none;
}
EOF;
echo '<pre>'.preg_replace( '~.*?{(.*?)}~s', implode ( ";", mySort( explode( ";" , "$1" ) ) ) , $css ).'</pre>';