<?php
/*
php.ini で以下のように設定されているものとします:
display_errors = On
register_globals = Off
post_max_size = 8M
*/
echo 'display_errors = ' . ini_get('display_errors') . "\n";
echo 'register_globals = ' . (int) ini_get('register_globals') . "\n";
echo 'post_max_size = ' . ini_get('post_max_size') . "\n";
echo 'post_max_size + 1 = ' . (rtrim(ini_get('post_max_size'), 'KMG') + 1) . "\n";
echo 'post_max_size in bytes = ' . return_bytes(ini_get('post_max_size'));
function return_bytes($val)
{
$val = trim($val);
$num = (int) rtrim($val, 'KMG');
$last = strtolower($val[strlen($val) - 1]);
switch ($last) {
// 'G' も使えます
case 'g':
$num = $num * 1024 * 1024 * 1024;
break;
case 'm':
$num = $num * 1024 * 1024;
break;
case 'k':
$num *= 1024;
break;
}
return $num;
}
?>
display_errors = 1
register_globals = 0
post_max_size = 8M
post_max_size+1 = 9
post_max_size in bytes = 8388608