function and variables inside a string highlighting

Let us know what you would like to see in the next version of this software

Moderator: kfury77

function and variables inside a string highlighting

Postby digi_al » Wed Oct 28, 2009 1:55 pm

Hi,

1. It would be great if we can get code highlighting for PHP function names.

2. Also for variables inside a string, eg:
"SELECT * from platform where id=$id"

Thanks and keep up the good work,

alan
digi_al
 
Posts: 2
Joined: Wed Oct 28, 2009 1:33 pm

Re: function and variables inside a string highlighting

Postby EvilBMP » Mon Nov 02, 2009 7:06 pm

digi_al wrote:"SELECT * from platform where id=$id"


Please write:

Code: Select all
'SELECT * FROM platform WHERE id = '. (int)$id


This is a much better coding style - better to read and more secure (see the type cast) - you don't have these issues then.
And as another sidenote - don't use the * selector in MySQL statements ;)

But, this is just a private opinion / hint :)

Greets Evil
User avatar
EvilBMP
 
Posts: 97
Joined: Thu Jan 04, 2007 1:57 am
Location: Germany

Re: function and variables inside a string highlighting

Postby digi_al » Tue Nov 03, 2009 4:12 am

please dont tell me how to program.

using a variable inside an sql statement is fine - you method is in no way more secure.

how do you know i have not already checked the variable for security? or its created inside the code and not been passed in?

for me (with an app that highlights variables like this correctly :) ), the way i wrote the code is more readable - even more so if i have lots of variables.
not sure about speed of executing though but i have never had speed problems with php

Anyway my post was about the bug in the application's code highlight routine.
digi_al
 
Posts: 2
Joined: Wed Oct 28, 2009 1:33 pm

Re: function and variables inside a string highlighting

Postby davenz » Wed Nov 04, 2009 10:35 am

Ouch, so much for that suggestion.
davenz
 
Posts: 174
Joined: Sun May 04, 2008 3:31 am
Location: New Zealand

Re: function and variables inside a string highlighting

Postby EvilBMP » Thu Nov 05, 2009 4:38 pm

digi_al wrote:not sure about speed of executing though but i have never had speed problems with php


Good for you ... but it's definitely slower, because PHP has to interpret each doublequote string to look for variables inside. So in large-scale applications this does matter. Nevertheless, that has nothing to do with your request. Again just a side note. Sorry for Offtopic.

Greets Evil
User avatar
EvilBMP
 
Posts: 97
Joined: Thu Jan 04, 2007 1:57 am
Location: Germany


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Feature Requests

Who is online

Users browsing this forum: No registered users and 1 guest