שמעו בניתי משהו שצובע את הקוד PHP.
הקוד:
PHP קוד:
$match = array('#\[PHP\](.*?)\[\/PHP\]#se');
$replace = array("'<div style=\"margin:25px; margin-top:5px\"><div class=\"smallfont\" style=\"margin-bottom:2px\">PHP ÷åã:</div><div class=\"alt2\" style=\"margin:0px; padding:6px; border:1px inset; overflow:auto\"><code style=\"white-space:nowrap\"><div dir=\"ltr\" style=\"text-align:left;\">'.highlight_string('$1', true).'</div></code></div></div>'");
$content = preg_replace($match, $replace, $content);
אבל הבעיה היא שכאשר זה מדפיס לי את הקוד הצבוע, יש משהו ממש מוזר.
על כל גרשיים (") שניים(לא ראשונים, אלא שניים) הוא מדפיס לי לפניהם \ (backslash)
דוגמא לאיך שהוא מדפיס לי:
PHP קוד:
<?php
echo "hello world\";
?>
דוגמא לאיך שזה אמור להיות:
PHP קוד:
<?php
echo "hello world";
?>
תודה