3v4l.org

run code in 300+ PHP versions simultaneously
<?php $tests = [ 'this is a test! this is a test! this is a test! this is a test! this is a test! cmyk derp.png', ' this is a test! this is a test! this is a test! this is a test! this is a test! cmyk x.png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! cmykx .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derpderp .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derpd .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test! derp .png ', ' this is a test! this is a test! this is a test! this is a test! this is a test.png ', 'this is a test! this is a test! this is a test! this is a test! this is a - - - - - - test.png', 'this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! this is a test! .png', 'this is a test! this is a test! this is a test! this is a test! this is a test! thisx is a test! this is a test! .png', 'this is a test! this is a test! this is a test! this is a test! this is a test! thisxy is a test! this is a test! .png', ]; foreach ( $tests as $originalFilename) { $filteredFilename = str_replace(' ', '-', strtolower(trim($originalFilename))); $filteredFilename = substr( $filteredFilename, 0, strrpos($filteredFilename,'.') ); $filteredFilename = preg_replace('/(\bcmyk\b)|([^a-z0-9\-]+)|(\-+$)/','',$filteredFilename); $filteredFilename = preg_replace('/-{2,}/','-',$filteredFilename); $filteredFilenameLength = strlen($filteredFilename); if ( $filteredFilenameLength > 80 ) { if ($filteredFilename[80] === '-') { echo 'case 1', PHP_EOL; $filteredFilename = substr($filteredFilename, 0, 80); } else { echo 'case 2', PHP_EOL; $filteredFilename = substr($filteredFilename, 0, strrpos($filteredFilename, '-', 80 - $filteredFilenameLength)); } } else { echo 'case 3', PHP_EOL; } echo $filteredFilenameLength, ' ', strlen($filteredFilename), ' ', $filteredFilename, PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
case 3 79 79 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-derp case 3 76 76 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-x case 3 80 80 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-cmykx case 2 83 74 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test case 3 80 80 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-derpd case 3 79 79 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-derp case 3 74 74 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test case 3 74 74 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test case 2 104 79 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this case 1 105 80 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-thisx case 2 106 74 this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test-this-is-a-test

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:
57.95 ms | 403 KiB | 8 Q