From 7f19af4412d5c3f56ca7e199668f6d1510006448 Mon Sep 17 00:00:00 2001 From: Paul Pazderski Date: Tue, 9 Jan 2024 00:04:55 +0100 Subject: [PATCH] Improve example to read ini shorthand the existing example cannot handle any later added shorthand formats and is simply outdated when a dedicated standard function exists --- reference/info/functions/ini-get.xml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/reference/info/functions/ini-get.xml b/reference/info/functions/ini-get.xml index 92cfeb9d7a79..9f4f7f1e9379 100644 --- a/reference/info/functions/ini-get.xml +++ b/reference/info/functions/ini-get.xml @@ -62,23 +62,7 @@ echo 'display_errors = ' . ini_get('display_errors') . "\n"; echo 'register_globals = ' . ini_get('register_globals') . "\n"; echo 'post_max_size = ' . ini_get('post_max_size') . "\n"; echo 'post_max_size+1 = ' . (ini_get('post_max_size')+1) . "\n"; -echo 'post_max_size in bytes = ' . return_bytes(ini_get('post_max_size')); - -function return_bytes($val) { - $val = trim($val); - $last = strtolower($val[strlen($val)-1]); - switch($last) { - // The 'G' modifier is available - case 'g': - $val *= 1024; - case 'm': - $val *= 1024; - case 'k': - $val *= 1024; - } - - return $val; -} +echo 'post_max_size in bytes = ' . ini_parse_quantity(ini_get('post_max_size')); ?> ]]>