I need to test the value returned by ini_get(\'memory_limit\')
and increase the memory limit if it is below a certain threshold, however this ini_get(\'me
Since you will get an error with newer versions of PHP if the value has a CHAR at the end of it, you might need some extra testing:
private function toBytes($str){
$val = trim($str);
$last = strtolower($str[strlen($str)-1]);
if (!is_numeric($last)) {
$val = substr($val,0,strlen($val)-1);
switch($last) {
case 'g': $val *= 1024;
case 'm': $val *= 1024;
case 'k': $val *= 1024;
}
}
return $val;
}
This works with no warnings