note 116519 added to function.isset

From: Date: Fri, 16 Jan 2015 20:46:48 +0000
Subject: note 116519 added to function.isset
Groups: php.notes 
Request: Send a blank email to php-notes+get-201440@lists.php.net to get a copy of this message
Am trying to create a 'generic is_set function' that i can pass any either a variable or multi-variables or an array and will return true if what is passed to it is set and false if what is passed to it false. This is what i came up with but. function is_set () { if(func_num_args() == 1 && is_array (func_get_arg(0))){ $arr = func_get_arg(0); $c = count($arr); for($i = 0; $i < $c; $i++){ if (!isset($arr[$i])) return false; } return true; } elseif(func_num_args() == 1 && !is_array (func_get_arg(0))) { $arg = func_get_arg(0); return (isset($arg)) ? true : false; } else{ $args = func_get_args(); for($i = 0; $i < count($args); $i++){ if (!is_set($args[$i])) return false; } return true; } } pls email me for any correction. Thanks ---- Server IP: 72.52.91.14 Probable Submitter: 41.220.68.236 ---- Manual Page -- http://php.net/manual/en/function.isset.php Edit -- https://master.php.net/note/edit/116519 Del: integrated -- https://master.php.net/note/delete/116519/integrated Del: useless -- https://master.php.net/note/delete/116519/useless Del: bad code -- https://master.php.net/note/delete/116519/bad+code Del: spam -- https://master.php.net/note/delete/116519/spam Del: non-english -- https://master.php.net/note/delete/116519/non-english Del: in docs -- https://master.php.net/note/delete/116519/in+docs Del: other reasons-- https://master.php.net/note/delete/116519 Reject -- https://master.php.net/note/reject/116519 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#201440) next »