3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function convertToBytes($from){ $number=substr($from,0,-2); switch(strtoupper(substr($from,-2))){ case "KB": return $number*1024; case "MB": return $number*pow(1024,2); case "GB": return $number*pow(1024,3); case "TB": return $number*pow(1024,4); case "PB": return $number*pow(1024,5); default: return $from; } } echo convertToBytes("2 GB"); ?>
Output for 7.1.0
Notice: A non well formed numeric value encountered in /in/UI0I1 on line 11 2147483648
Output for 4.3.0 - 7.0.14
2147483648