A shame for me but I must tell you this function called extract() simply rocks : it will extract “keys” from an array and convert them into variables, so no more needed to manually declare variables for validation purposes from forms.
<form action="" method="post"> name <input type="text" name="name"><br/> email <input type="text" name="email"><br/> <input type="submit" name="sb" id="sb" value="go"> </form> <?php if(isset($_POST['sb'])) { extract($_POST); if(empty($name) || empty($email)) die("email and name emtpy"); print "Name is $name and email is $email now!"; } ?>
hey this is a very interesting article!
I must admit I’d not encountered this function before, didn’t know it existed. Should prove useful, so thanks.
me too here, just discovered it, isn’t it a nice one?