3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'LocalBusiness' => 'Local Business', 'CivicStructureBuilding' => 'Civic Structure Building', 'getUserMobilePhoneNumber' => 'Get User Mobile Phone Number', 'bandGuitar1' => 'Band Guitar 1', 'band2Guitar123' => 'Band 2 Guitar 123', 'CustomerIDWithSomeOtherJETWords' => 'Customer ID With Some Other JET Words', 'noOneIsMightierThanI' => 'No One Is Mightier Than I', 'USAIsNumber14' => 'USA Is Number 14', '99LuftBallons' => '99 Luft Ballons', 'fillOutYour403EForm' => 'Fill Out Your 403 E Form', 'ABC123IsEasyAs' => 'ABC 123 Is Easy As', ]; $result = []; foreach ($tests as $input => $expected) { $newString = ucwords( preg_replace( '/(?: [A-Z]+? (?=\d|[A-Z][a-z]) #acronyms |[A-Z]?[a-z]+ (?=[^a-z]) #words |\d+ (?=\D) #numbers |(*SKIP)(*FAIL) #abort )\K /x', ' ', $input ) ); $result[] = ($newString === $expected ? 'PASSED' : 'FAILED') . ': "' . $newString . '"'; } var_export($result);
Output for 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
array ( 0 => 'PASSED: "Local Business"', 1 => 'PASSED: "Civic Structure Building"', 2 => 'PASSED: "Get User Mobile Phone Number"', 3 => 'PASSED: "Band Guitar 1"', 4 => 'PASSED: "Band 2 Guitar 123"', 5 => 'PASSED: "Customer ID With Some Other JET Words"', 6 => 'PASSED: "No One Is Mightier Than I"', 7 => 'PASSED: "USA Is Number 14"', 8 => 'PASSED: "99 Luft Ballons"', 9 => 'PASSED: "Fill Out Your 403 E Form"', 10 => 'PASSED: "ABC 123 Is Easy As"', )
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:
96.27 ms | 407 KiB | 5 Q