3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $default = '10px'; $string = trim( strtolower( (string) '-20%x' ) ); if( strpos( $string, 'auto') !== false || strpos( $string, '0') !== false || preg_match( '/[+-]?[0-9]+.?([0-9]+)?(em|ex|%|px|cm|mm|in|pt|pc|ch|rem|vh|vw|vmin|vmax)$/', $string ) ) { echo $string; } else { echo $default; }
based on nXCu0
Output for 4.3.0 - 7.2.0
-20%x