The method to which you linked works perfectly well when you escape the quotes properly as shown below with a simple echo
and an alternative printf
statement.
Notice that the single quotes within the output string are escaped using a backslash!
$row['updated_at']='2022/03/20 08:32:12';
$date=date( 'F j, Y', strtotime( $row['updated_at'] ) );
printf(
'Last Revision: %s <a href="//example.com/contact.php" onclick="window.open(\'/contact.php\',\'Contact\',\'width=800,height=600\'); return false">Contact us</a>',
$date
);
echo 'Last Revision: '.$date.' <a href="//example.com/contact.php" onclick="window.open(\'/contact.php\',\'Contact\',\'width=800,height=600\'); return false">Contact us</a>';