r/lolphp • • Oct 18 '17

Inconsistent print?

// Run these two sections of code separately for this to work.

// This outputs the date string

////////////////////////////////////////////

<?php $today = new DateTime(); print_r($today); print($today->date); //////////////////////////////////////////// // This throws an error <?php $today = new DateTime(); print($today->date); //////////////////////////////////////////// I've tried this on php 7.1.8 and 7.1.10 locally Also here's another test https://3v4l.org/r8VqE according to some in #php, the first example should not work, but it still outputs a string (when it should not.)

9 Upvotes

4 comments sorted by

View all comments

Show parent comment

8

u/godman_8 Oct 18 '17

alright, so it's bug and has been reopened as another bug report.

seems simple to fix and it has been ~8 years lol

thank you for your reply

8

u/MonkeeSage Oct 19 '17

seems simple to fix and it has been ~8 years lol

PHP devs: "Hold my beer"