note 83620 added to function.isset

From: Date: Wed, 04 Jun 2008 21:19:22 +0000
Subject: note 83620 added to function.isset
Groups: php.notes 
Request: Send a blank email to php-notes+get-140128@lists.php.net to get a copy of this message
Below a user by the name of Scott posted an isval() function; I just wanted to point out a revision to his method since it's a bit lengthy for what it does. The trick is to realize that a boolean AND clause will terminate with false as soon as it encounters anything that evaluates to false, and will skip over any remaining checks. Instead of taking up the space to define isval(), you could just run inline commands for each variable you need to check this: <?php $isval = isset($_POST['var']) && !empty($_POST['var']); ?> Also be warned that if you try to encapsulate this into a function, you might encounter problems. It's meant to stand alone. ---- Server IP: 64.71.164.2 Probable Submitter: 66.170.10.66 ---- Manual Page -- http://www.php.net/manual/en/function.isset.php Edit -- https://master.php.net/note/edit/83620 Del: integrated -- https://master.php.net/note/delete/83620/integrated Del: useless -- https://master.php.net/note/delete/83620/useless Del: bad code -- https://master.php.net/note/delete/83620/bad+code Del: spam -- https://master.php.net/note/delete/83620/spam Del: non-english -- https://master.php.net/note/delete/83620/non-english Del: in docs -- https://master.php.net/note/delete/83620/in+docs Del: other reasons-- https://master.php.net/note/delete/83620 Reject -- https://master.php.net/note/reject/83620 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#140128) next »