Home Download Buy Blog Forum Support

PHP syntax highlighting error

PHP syntax highlighting error

Postby smaffer on Tue Feb 26, 2013 9:29 pm

Hi,
i'm using the latest version of SublimeText2. I've found this error:
<?php
echo "UPDATE /data/*.png string blabla<br>";
?>
The syntax highlighter highlight all the characters after /* as a comment. The problem exists only with UPDATE, this example work:
<?php
echo "blabla /data/*.png string blabla<br>";
?>

Bye,
smaffer
smaffer
 
Posts: 1
Joined: Tue Feb 26, 2013 9:25 pm

Re: PHP syntax highlighting error

Postby agibsonsw on Tue Feb 26, 2013 10:50 pm

The word UPDATE is causing the string to be parsed as a SQL statement. You could escape the asterisk:

Code: Select all
<?php
echo "UPDATE /data/\*.png string blabla<br>";
?>

but it would still be parsed as SQL. Alternatively, you might try splitting it:

Code: Select all
<?php
echo "UPDATE " . "/data/*.png string blabla<br>";
?>

or even (if necessary!):
Code: Select all
<?php
echo "UP" . "DATE " . "/data/*.png string blabla<br>";
?>
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
agibsonsw
 
Posts: 901
Joined: Fri Jan 27, 2012 9:11 pm


Return to Technical Support

Who is online

Users browsing this forum: No registered users and 12 guests