ExpressionEngine サイトで生年月日から人の年齢を計算しようとしています。次のコードは私のローカル テスト サイトで動作しますが、サーバーは古いバージョンの PHP (5.2.17) を使用しているため、エラーが発生します。誰かが代わりに使用する必要があるコードを提案できますか?
{exp:channel:entries channel='zoo_visitor'}
<?php
$dob = new DateTime('{member_birthday format='%Y-%m-%d'}');
$now = new DateTime('now');
// This returns a DateInterval object.
$age = $now->diff($dob);
// You can output the date difference however you choose.
echo 'This person is ' .$age->format('%y') .' years old.';
?>
{/exp:channel:entries}