Showing posts with label variables. Show all posts
Showing posts with label variables. Show all posts

Wednesday, May 30, 2012

Is there a better way of writing v = (v == 0 ? 1 : 0);


I want to toggle a variable between 0 and 1. If it's 0 I want to set it to 1, else if it's 1 I want to set it to 0.

Thursday, April 19, 2012

Sunday, April 8, 2012

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

Friday, April 6, 2012

Is this a php variable variable bug?


Is there a logical explanation to this?




<?php
$$a = 'hello world';
echo $$a; //displays hello world
echo $$aa; //displays hello world
echo $$aaa; //displays hello world
?>

Thursday, April 5, 2012

jQuery dialog button variable


Can anyone tell me how can i use a varaible for button text in jQuery UI dialogs. I want to make a dynamic button name.

Sunday, March 11, 2012

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.

Tuesday, February 14, 2012

Sunday, January 29, 2012

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