3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $products_date_added = date_create('2015-09-30'); $ndate = date_create(); date_sub($ndate, date_interval_create_from_date_string("30 days")); echo $nDate->format("Y-m-d"); $diff = date_diff( $products_date_added, $ndate ); echo $diff->format("%a"); ?>
based on UI5q0
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: nDate in /in/aDbjR on line 5 Fatal error: Uncaught Error: Call to a member function format() on null in /in/aDbjR:5 Stack trace: #0 {main} thrown in /in/aDbjR on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: nDate in /in/aDbjR on line 5 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/aDbjR:5 Stack trace: #0 {main} thrown in /in/aDbjR on line 5
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Notice: Undefined variable: nDate in /in/aDbjR on line 5 Fatal error: Call to a member function format() on null in /in/aDbjR on line 5
Process exited with code 255.
Output for 5.3.19 - 5.5.35
Notice: Undefined variable: nDate in /in/aDbjR on line 5 Fatal error: Call to a member function format() on a non-object in /in/aDbjR on line 5
Process exited with code 255.