I am using some of the available constants in PHP to show the date and time in a particular format:
$created_date=date(Y.'-'.m.'-'.d.'\T'.H.':'.i.':'.s.'\Z',$created_timestamp);
Since updating from PHP 7.1 to 7.4, I get the following messages in the log file:
PHP Warning: Use of undefined constant Y - assumed 'Y' (this will throw an Error in a future version of PHP)
PHP Warning: Use of undefined constant m - assumed 'm' (this will throw an Error in a future version of PHP)
PHP Warning: Use of undefined constant d - assumed 'd' (this will throw an Error in a future version of PHP)
PHP Warning: Use of undefined constant H - assumed 'H' (this will throw an Error in a future version of PHP)
PHP Warning: Use of undefined constant i - assumed 'i' (this will throw an Error in a future version of PHP) PHP Warning: Use of undefined constant s - assumed 's' (this will throw an Error in a future version of PHP)
I can't seem to find any documentation (or ideally) examples of how I could update my code to get rid of this problem.
Thanks for any help
'Y-m-d\TH:i:s\Z'print date('Y-m-d\TH:i:s\Z');note that the "constants" are actually parts of the stringdate(y.'-'.m.'-'.d)is assumed as:date('y'.'-'.'m'.'-'.'d')->date('y-m-d'). The code in the Q is wrong but works becasue of a quirck. The error is becasue the quirck no longer works