3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_config_bytes($val) { $val = trim($val); $last = substr($val, -1); // Get the last character $val = rtrim($val, $last); // Trim away the last character which isn't a number switch(strtolower($last)) { case 'g': $val *= 1024; case 'm': $val *= 1024; case 'k': $val *= 1024; } return $val; } var_dump(get_config_bytes('20M'));
Output for git.master, git.master_jit, rfc.property-hooks
int(20971520)

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
137.73 ms | 405 KiB | 5 Q