note 69898 added to function.ini-get

From: Date: Mon, 25 Sep 2006 18:40:49 +0000
Subject: note 69898 added to function.ini-get
Groups: php.notes 
Request: Send a blank email to php-notes+get-117648@lists.php.net to get a copy of this message
@Webmaster at GrimChild dot com Your suggestion to simply strip the [gmk] letters would actually be very unpredictable since you no longer know the magnitude of the number. Therefore if you have 8K and 8M they would be both equal after your function. Also the following would be incorrect: <?php // Incorrect code function parse_size($size) { return eregi_replace('[gmk]','',$size); } //Check that we have at least 4M of post space // assume post_max_size = 16K if(parse_size(ini_get('post_max_size')) < parse_size("4M")) { die('Error: this script requires more than 4M of post space'); } ?> As you can see in this scenario the functions would return 16 and 4 respectively, allowing the check to succeed with less memory than 4M. ---- Server IP: 216.235.15.211 Probable Submitter: 70.24.10.161 ---- Manual Page -- http://www.php.net/manual/en/function.ini-get.php Edit -- https://master.php.net/note/edit/69898 Del: integrated -- https://master.php.net/note/delete/69898/integrated Del: useless -- https://master.php.net/note/delete/69898/useless Del: bad code -- https://master.php.net/note/delete/69898/bad+code Del: spam -- https://master.php.net/note/delete/69898/spam Del: non-english -- https://master.php.net/note/delete/69898/non-english Del: in docs -- https://master.php.net/note/delete/69898/in+docs Del: other reasons-- https://master.php.net/note/delete/69898 Reject -- https://master.php.net/note/reject/69898 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117648) next »