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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.