3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $fields = Array( 'viewers' => Array('title' => 'Viewers', 'type'=> 'select', 'field' => 'count(distinct(v.systemid)) as `viewers`'), 'views' => Array('title' => 'Views', 'type'=> 'select', 'field' => 'count(v.viewid) as `views`'), 'totalDuration' => Array('title'=> 'Total View Length', 'type'=> 'select', 'field' => 'sum(TIMESTAMPDIFF(SECOND,v.ts,v.ts_end)) as `total duration`'), 'avgDuration' => Array('title'=> 'Avg view length', 'type'=> 'select', 'field' => '(sum(TIMESTAMPDIFF(SECOND,v.ts,v.ts_end)) / count(v.viewid)) as `average duration`'), 'clipname' => Array('title'=>'Video ID', 'type'=> 'group', 'field' => 'v.clipname as `clipname`'), 'startDate' => Array('title'=>'Actual Start Date', 'type'=> 'group', 'field' => 'p.startDate'), 'startTime' => Array('title'=>'Actual Start Time', 'type'=> 'group', 'field' => 'p.startTime'), 'date' => Array('title'=>'Date', 'type'=> 'group', 'field' => 'DATE(v.ts) AS ForDate'), 'stage' => Array('title'=>'Player State', 'type'=> 'group', 'field' => 'v.stage'), 'platform' => Array('title'=>'OS', 'type'=> 'group', 'field' => 's.platform'), 'browser' => Array('title'=>'Browser', 'type'=> 'group', 'field' => 's.browser'), 'alias' => Array('title'=>'Alias', 'type'=> 'group', 'field' => 'p.alias'), 'house' => Array('title'=>'House', 'type'=> 'group', 'field' => 'p.house'), 'business' => Array('title'=>'Business', 'type'=> 'group', 'field' => 'p.business'), 'eventType' => Array('title'=>'Event Type', 'type'=> 'group', 'field' => 'p.eventType'), 'title' => Array('title'=>'Title', 'type'=> 'group', 'field' => 'p.title') ); print_r($fields);
based on Bl11l
Output for 4.3.0 - 7.2.0
Array ( [viewers] => Array ( [title] => Viewers [type] => select [field] => count(distinct(v.systemid)) as `viewers` ) [views] => Array ( [title] => Views [type] => select [field] => count(v.viewid) as `views` ) [totalDuration] => Array ( [title] => Total View Length [type] => select [field] => sum(TIMESTAMPDIFF(SECOND,v.ts,v.ts_end)) as `total duration` ) [avgDuration] => Array ( [title] => Avg view length [type] => select [field] => (sum(TIMESTAMPDIFF(SECOND,v.ts,v.ts_end)) / count(v.viewid)) as `average duration` ) [clipname] => Array ( [title] => Video ID [type] => group [field] => v.clipname as `clipname` ) [startDate] => Array ( [title] => Actual Start Date [type] => group [field] => p.startDate ) [startTime] => Array ( [title] => Actual Start Time [type] => group [field] => p.startTime ) [date] => Array ( [title] => Date [type] => group [field] => DATE(v.ts) AS ForDate ) [stage] => Array ( [title] => Player State [type] => group [field] => v.stage ) [platform] => Array ( [title] => OS [type] => group [field] => s.platform ) [browser] => Array ( [title] => Browser [type] => group [field] => s.browser ) [alias] => Array ( [title] => Alias [type] => group [field] => p.alias ) [house] => Array ( [title] => House [type] => group [field] => p.house ) [business] => Array ( [title] => Business [type] => group [field] => p.business ) [eventType] => Array ( [title] => Event Type [type] => group [field] => p.eventType ) [title] => Array ( [title] => Title [type] => group [field] => p.title ) )