3v4l.org

run code in 300+ PHP versions simultaneously
<?php $bodycontent = "<p>We've been in business since 1998 and produced this logo design [1995] years ago.</p>\n"; $bodycontent .= "<p>We've been in business since 1998 and produced this website design [2018] years ago.</p>\n"; $bodycontent .= "<p>We've been in business since 1998 and produced this website design [2017] years ago.</p>\n"; $bodycontent .= "<p>We've been in business since 1998 and produced this website design [2016] years ago.</p>"; $lookup=['less than a','one','two','three','four','five','six','seven','eight','nine', 'ten','eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen' ]; // extend as needed $bodycontent = preg_replace_callback('/\[(\d{4})] years ago/', function($m)use($lookup){ $diff=date('Y')-$m[1]; if(isset($lookup[$diff])){ return $lookup[$diff].' year'.($diff>1?'s':'').' ago'; }else{ return "in {$m[1]}"; // out of lookup range, use backup text } }, $bodycontent); echo $bodycontent;
Output for git.master, git.master_jit, rfc.property-hooks
<p>We've been in business since 1998 and produced this logo design in 1995.</p> <p>We've been in business since 1998 and produced this website design less than a year ago.</p> <p>We've been in business since 1998 and produced this website design one year ago.</p> <p>We've been in business since 1998 and produced this website design two years ago.</p>

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:
37.91 ms | 406 KiB | 5 Q