note 77620 added to function.highlight-string

From: Date: Thu, 06 Sep 2007 03:47:55 +0000
Subject: note 77620 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-130232@lists.php.net to get a copy of this message
When you quote highlighted PHP code in your website you need to escape quotes. If you quote a lot it may be annoyning. Here is tiny snippet how to make quoting tidy and clean. Write your code like this: <?code()?> $string = 'Here I put my code'; <?code()?> And somewhere else define the function: <? function code() { static $on=false; if (!$on) ob_start(); else { $buffer= "<?\n".ob_get_contents()."?>"; ob_end_clean(); highlight_string($buffer); } $on=!$on; } ?> ---- Server IP: 203.220.0.234 Probable Submitter: 125.27.5.88 ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit -- https://master.php.net/note/edit/77620 Del: integrated -- https://master.php.net/note/delete/77620/integrated Del: useless -- https://master.php.net/note/delete/77620/useless Del: bad code -- https://master.php.net/note/delete/77620/bad+code Del: spam -- https://master.php.net/note/delete/77620/spam Del: non-english -- https://master.php.net/note/delete/77620/non-english Del: in docs -- https://master.php.net/note/delete/77620/in+docs Del: other reasons-- https://master.php.net/note/delete/77620 Reject -- https://master.php.net/note/reject/77620 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130232) next »