Jump to content

PHP highlight


Jezdo

Recommended Posts

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!
Link to comment
https://forums.phpfreaks.com/topic/19504-php-highlight/
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/19504-php-highlight/#findComment-84822
Share on other sites

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.
Link to comment
https://forums.phpfreaks.com/topic/19504-php-highlight/#findComment-84861
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.