note 56244 added to function.ob-start

From: Date: Sun, 28 Aug 2005 15:50:39 +0000
Subject: note 56244 added to function.ob-start
Groups: php.notes 
Request: Send a blank email to php-notes+get-94300@lists.php.net to get a copy of this message
If you want to run code in the middle of a string that you made, but you want to wait the printing... (so if you want to allow php in bb-code style, and you want to execute it in order, and print everything in order...) phpRun($code) { ob_start(); exec($code); $output = ob_get_contents(); ob_end_clean(); return $output; } $str = str_replace("]\n", "]", $str); $match = array('#\[php\](.*?)\[\/php\]#se'); $replace = array( phpRun( stripslashes('$1') ) ); $str= preg_replace($match, $replace, $str); echo $str; ---- Manual Page -- http://www.php.net/manual/en/function.ob-start.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+56244 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+56244&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+56244&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#94300) next »