3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $wdUses = array(); $ssUses = array(); $monthArray = array(); $subTime = date('Y-m-d', strtotime('-1 years')); $currentTime = date('Y-m-d'); echo $subTime; $wdLog = AuditLog::findAllInDateRangeWithProductIdsAndActionId(date('y-m-d h', $subTime) ,$currentTime, 1, 1); $ssLog = AuditLog::findAllInDateRangeWithProductIdsAndActionId(date('y-m-d h', $subTime) ,$currentTime, 3, 1); for($i = 0; $i < 12; $i++) { $startTime = date('Y-m-d', strtotime('-$i months')); $endTime = date('Y-m-d', strtotime('-($i +1) months')); foreach ($wdLog as $log) { if( $log->getDateTime() >= $subtime && $log->getDateTime() < $endTime ) { ++$wdUses[$i]; } } foreach ($ssLog as $log) { if( $log->getDateTime() >= $subtime && $log->getDateTime() < $endTime ) { ++$ssUses[$i]; } } $monthArray[$i] = $startTime(); } $wdUses = json_encode($wdUses); $ssUses = json_encode($ssUses); $monthArray = json_encode($monthArray); ?>
based on eaocn
Output for 7.0.0 - 7.2.0
2014-09-16 Fatal error: Uncaught Error: Class 'AuditLog' not found in /in/4nnUV:12 Stack trace: #0 {main} thrown in /in/4nnUV on line 12
Process exited with code 255.
Output for 5.4.0 - 5.6.25
2014-09-16 Fatal error: Class 'AuditLog' not found in /in/4nnUV on line 12
Process exited with code 255.