note 89363 deleted from function.list by danbrown

From: Date: Wed, 04 Mar 2009 18:46:12 +0000
Subject: note 89363 deleted from function.list by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-151476@lists.php.net to get a copy of this message
Note Submitter: mr dot davin at gmail dot com ---- You can use isset with a list as it appears to unset the variable if there is not a value to assign to it. $values = array ( '1 2 3', '1 2', '1' ); foreach ($values as $v) { list ($v1, $v2, $v3) = explode (' ',$v); echo (isset ($v1) ? 'Y' : 'N'); echo (isset ($v2) ? 'Y' : 'N'); echo (isset ($v3) ? 'Y' : 'N'); echo '<br />'; } Results in: YYY YYN YNN YNN

« previous php.notes (#151476) next »