Simple coding question

From: Date: Fri, 19 Nov 2004 09:44:15 +0000
Subject: Simple coding question
Groups: php.general 
Request: Send a blank email to php-general+get-202492@lists.php.net to get a copy of this message
Hi all, Please tell me which is the shortest method for writing the following code: $var = $_GET['var'] || 'value'; I want the program to put the value "value" in the variable $var if the array element 'var' is not defined or in case it is 0 and I would like to avoid using that long style with if (..) {...} else {...}... Thank you. Teddy

« previous php.general (#202492) next »