<?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;
<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>