Skip to main content

Posts

Showing posts with the label variables

var x, y = "foo"; Can this be accomplished?

Since it is possible to do: var x = 'foo', y = 'foo'; Would this also be possible? var x, y = 'foo'; I tried it, however x becomes undefined. I know this may seem like a silly or redundant question, but if I'm curious about something, why not ask? Also you will probably wonder why I would need two variables equal to the same thing in scope . That is not the point of the question. I'm just curious. Source: Tips4all

Why does Java allow control characters in its identifiers?

The Mystery In exploring precisely which characters were permitted in Java identifiers, I have stumbled upon something so extremely curious that it seems nearly certain to be a bug. I’d expected to find that Java identifiers conformed to the requirement that they start with characters that have the Unicode property ID_Start and are followed by those with the property ID_Continue , with an exception granted for leading underscores and for dollar signs. That did not prove to be the case, and what I found is at extreme variance with that or any other idea of a normal identifier that I have heard of. Short Demo Consider the following demonstration proving that an ASCII ESC character (octal 033) is permitted in Java identifiers: $ perl -le 'print qq(public class escape { public static void main(String argv[]) { String var_\033 = "i am escape: \033"; System.out.println(var_\033); }})' > escape.java $ javac escape.java $ java escape | cat -v i am escape: ^[

Is it preferred to assign POST variable to an actual variable?

I've just completed my registration form for my website and for the action page where all the SQL takes place I've just skipped assigning the POST variable to actual ones, like this... $username = $_POST['username']; Instead I've just been using the POST variables throughout the PHP page. Are there any risks or errors that can be met whilst practicing? Also, excuse me if I am using incorrect terminology...