Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 03-28-2005, 06:05 AM [php] Ubbc Tag
Skilled Talker

Posts: 77
Location: London
Trades: 0
PHP Code:

<?php

    
while ( preg_match("[\[php\](.+?)\[/php\]]"$text) )

      {

        
$text preg_replace("[\[php\](.+?)\[/php\]]""<br><table width='90%' bgcolor='#000000' cellspacing='1' cellpadding='3' border='0' align='center' height='20'><tr><td class='td3' align='left'>PHP Code:</td></tr><tr><td class='td2' align='left'>$1</td></tr></table>"$text);

      }

?>
How do I make $1 be highlight_string(); ?

Luke
__________________

Please login or register to view this content. Registration is FREE

http://v2designs.com - Supported By Xigna Hosting
lukedyson is offline
Reply With Quote
View Public Profile Visit lukedyson's homepage!
 
 
Register now for full access!
Old 03-28-2005, 07:10 AM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
I found this in the 'User comments' list on the highlight_string() PHP manual page:

PHP Code:
<?php
function bbcode($s)
{
   
$s str_replace("]\n""]"$s);
   
$match = array('#\[php\](.*?)\[\/php\]#se');
   
$replace = array("'<div>'.highlight_string(stripslashes('$1'), true).'</div>'");
   return 
preg_replace($match$replace$s);
}
?>
Seems you just enclose $1 in the function call (with stripslashes too) and then concatenate it with the replace string?
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Reply     « Reply to [php] Ubbc Tag
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.09449 seconds with 12 queries