3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $stringToReplace = "opening-ceremony-600x450.d20140220-u162540.jpg"; $removeTimestamp = strlen($stringToReplace); $removeTimestamp = floor($removeTimestamp - 21); $example_1 = substr_replace($stringToReplace, "jpg",$removeTimestamp); echo "Example 1: ".$example_1."\n\n"; $stringToReplace = "marc-by-marc-jacobs-13-black-136831_3-90x90.d20140220-u071915.jpg"; $removeTimestamp = strlen($stringToReplace); $removeTimestamp = floor($removeTimestamp - 21); $example_2 = substr_replace($stringToReplace, "jpg",$removeTimestamp); echo "Example 2: ".$example_2;
Output for 4.3.0 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Example 1: opening-ceremony-600x450.jpg Example 2: marc-by-marc-jacobs-13-black-136831_3-90x90.jpg