Jezdo Posted September 2, 2006 Share Posted September 2, 2006 HELP PEOPLE!Hi everyone. I have next BBCode:[CODE] $PHPCodeLayout = '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" background="images/code.jpg"> <tr> <td><span class="quotecodeheader style1">PHP kod: </span></td> </tr> <tr> <td background="images/code.jpg">'. highlight_string(stripslashes('$1'), true).'</td> </tr> </table>'; // Check for [code=php:0] text $Text = preg_replace("/\[php\](.+?)\[\/php\]/is","$PHPCodeLayout", $Text);[/CODE]So, what is the problem?[url=http://skripte.jezdo.net/tutoriali/pogledaj.php?cat=php&id=7]http://skripte.jezdo.net/tutoriali/pogledaj.php?cat=php&id=7[/url]It doesn't highlight the sintax. :(Please, can you help me? I searched for help everywhere but I didn't find it - you are my last hope.Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/19504-php-highlight/ Share on other sites More sharing options...
AndyB Posted September 2, 2006 Share Posted September 2, 2006 Variable names follow the same rules as other labels in PHP. A valid variable name starts with a letter or underscore, followed by any number of letters, numbers, or underscores.If the highlight is supposed to appy to a string that appears to start with a number ...The link you cite leads to a page that's in a language I can't understand.Also, do NOT send PMs to moderators claiming an 'urgent' need for help. Quote Link to comment https://forums.phpfreaks.com/topic/19504-php-highlight/#findComment-84822 Share on other sites More sharing options...
wildteen88 Posted September 2, 2006 Share Posted September 2, 2006 I find it easier to use a function called preg_replace_callback when doing this sort of thing. Have a read of [url=http://www.phpfreaks.com/forums/index.php/topic,102527.msg407109.html#msg407109]this post[/url] of mine for an example.What you do is create a dedicated function which will be called by preg_replace_callback when a match is found. Quote Link to comment https://forums.phpfreaks.com/topic/19504-php-highlight/#findComment-84861 Share on other sites More sharing options...
Demonic Posted September 2, 2006 Share Posted September 2, 2006 i gave up on that php tags :( Quote Link to comment https://forums.phpfreaks.com/topic/19504-php-highlight/#findComment-84862 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.