note 129199 added to function.filter-var

From: Date: Sat, 27 Jan 2024 16:17:58 +0000
Subject: note 129199 added to function.filter-var
Groups: php.notes 
Request: Send a blank email to php-notes+get-221153@lists.php.net to get a copy of this message
<?php function validateNumber($value){ if(filter_var($value, FILTER_VALIDATE_INT) === FALSE){ return false; }else{ return true; } } // Using a constant, but could use a variable $converse=166.386; $money = $_REQUEST['money']; /* We could do a more basic check, but it wouldn't handle if we input text if ($money == "") print ("<p>You must enter a quantity</p>"); */ if (!validateNumber($money)) print ("<p>You must enter a valid quantity</p>"); else { $pesetas = $money * $converse; print ("<p>$money unit(s) is/are equivalent to $pesetas pesetas</p>"); } ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 139.47.59.124) ---- Manual Page -- https://php.net/manual/en/function.filter-var.php Edit -- https://main.php.net/note/edit/129199 Del: integrated -- https://main.php.net/note/delete/129199/integrated Del: useless -- https://main.php.net/note/delete/129199/useless Del: bad code -- https://main.php.net/note/delete/129199/bad+code Del: spam -- https://main.php.net/note/delete/129199/spam Del: non-english -- https://main.php.net/note/delete/129199/non-english Del: in docs -- https://main.php.net/note/delete/129199/in+docs Del: other reasons-- https://main.php.net/note/delete/129199 Reject -- https://main.php.net/note/reject/129199 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221153) next »