Well it's advanced for me anyway considering I still can't get my head around the ereg syntax!!
Ok. I've got a 'nearly finished' class that will highlight PHP syntax depending on their group... for example GD syntax can be one colour, DBM syntax in another colour, Directory syntax in another, MySQL in another... and so on. So far I have 79 different syntax 'groups' that can be coloured.
I've tried finding the various syntax text (which is stored in a big array) using a combination of various explode(), str_replace() and other functions on the $string of code.
One of the problems that I have though is that if there is a line of code in the $string which looks like this... echo("blabla echo ablabl str_replace me ablabl".str_replace($a, $b, $c)); ...then ALL of the "echo" and "replace" text gets coloured.
I guess I'm trying to find a way of finding each word based on a set of rules.... colouring "str_replace" if it is not within a block of text (like above) for example. I've tried replacing str_replace( which works unless the actual text is str_replace ( then it doesn't work.
I hope that makes sense... basically I'm trying to replace "real" php syntax and not stuff that might appear within an echoed sentence or anything. I guess it's a more advanced version of highlight_string()
Any ideas or help would be very good as I'm completely stumpt by the whole ereg thing at the moment.
Advanced Eregi_Replace()
Moderator: General Moderators