3v4l.org

run code in 300+ PHP versions simultaneously
<?php $MsgAry1 = ["A","B","C","D","E","F","G","H","I","J", "K","L","M","N","O","P","Q","R","S","T", "U","V","W","X","Y","Z","a","b","c","d", "e","f","g","h","i","j","k","l","m","n", "o","p","q","r","s","t","u","v","w","x", "y","z","1","2","3","4","5","6","7","8", "9","0",".",",","'","?","!"," ","_","-"]; $strings = [ 'test', '1234', 'w0ws3r!', '##tag##', "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'?! _-" ]; foreach ($strings as $string) { echo "$string match: " . var_export(!preg_match('~[^\w.,\'?! -]~', $string), true) . "\n"; echo "$string ltrim: " . var_export(!strlen(ltrim($string, implode($MsgAry1))), true) . "\n"; echo "$string ranged ltrim, chars remaining: \"" . ltrim($string, 'A..Za..z0..9.,\'?! _-') . "\"\n---\n"; }
Output for 7.4.0 - 7.4.33, 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
test match: true test ltrim: true test ranged ltrim, chars remaining: "" --- 1234 match: true 1234 ltrim: true 1234 ranged ltrim, chars remaining: "" --- w0ws3r! match: true w0ws3r! ltrim: true w0ws3r! ranged ltrim, chars remaining: "" --- ##tag## match: false ##tag## ltrim: false ##tag## ranged ltrim, chars remaining: "##tag##" --- ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'?! _- match: true ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'?! _- ltrim: true ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,'?! _- ranged ltrim, chars remaining: "" ---
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
175.33 ms | 408 KiB | 5 Q