I have just had a wordpress template fail giving E_PARSE errors on a number of lines with the following syntax:
$thumbnail_size = $post->image_size ?? 'medium';
I am not familiar with the ?? operator so replaced the lines with this:
$thumbnail_size = $post->image_size ? $post->image_size : 'medium';
- Is this an equivalent statement?
- Is there any reason why ?? should fail? (PHP Version 5.6.40, Wordpress 6.1.1)
The original code was working 3 days ago. Wordpress version hasn't changed and PHP Info doesn't suggest the PHP version has changed for over 6 months.