3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Declare everything to be output before the table $before = <<<BEFORE BEFORE; // Declare everything to be output after the table $after = <<<AFTER <div class="table-legend"> <h4>Activity Codes key:</h4> <ol class="legend-list three-col"> <li>Civil engineering and buildings</li> <li>Electrical engineering and energy</li> <li>Electronics (including radiofrequency equipment)</li> <li>Computer systems and communication, including rental and maintenance</li> <li>Mechanical structures - Supplies &amp; manufacturing techniques</li> <li>Vacuum and low-temperature technology</li> <li>Particle detectors</li> <li>Miscellaneous (insurances, photoequipment, gases, vehicles, petrol, tools, furniture, office supplies, publications)</li> <li>Design studies - Miscellaneous supplies</li> </ol> <ul><li><sup>1</sup> Including commitments carried forward from previous years and excluding commitments for future years. Ratio between the percentage of expenditure in an individual Member State for the above-mentioned period and that Member State's percentage contribution to the Budget <em>(TARGET for 2013: 0.91)</em>.</li> <li><sup>2</sup> Additional special contributions from France (excluding in-kind) and Switzerland were included in the calculation. Excluding individual purchase orders &lt; 1 000 CHF from 1 July 2013</li> <!--<li><sup>3</sup> See Table V of document <em>CERN/FC/5722/RA</em></li>--></ul> </div> AFTER; // fixme: this formats are obsolete, since data transform has been moved to 'body' // Formats for numbers. ### is a wildcard for 'current column' $to_french_number = "TO_CHAR(###, '999G999G999', 'NLS_NUMERIC_CHARACTERS = '', ''')"; $to_percent = "TO_CHAR(ROUND(###, 2), '90.00')"; $table_template = array( 'db' => array( 'from' => 'PURCHASING_REPORT_TABLE_0', 'select' => array( 'MS' => FALSE, 'COUNTRY_ISO' => FALSE, 'COUNTRY_NAME' => NULL, 'SUPPLIES_1' => '###', 'SUPPLIES_2' => '###', 'SUPPLIES_3' => '###', 'SUPPLIES_4' => '###', 'SUPPLIES_5' => '###', 'SUPPLIES_6' => '###', 'SUPPLIES_7' => '###', 'SUPPLIES_8' => '###', 'SUPPLIES_9' => '###', 'SUPPLIES_TOTAL' => '###', 'SUPPLIES_RATIO' => '###', 'IR_PREV_YEAR' => '###', ), 'where' => array( 'MS' => array('LIKE', '%'), 'COUNTRY_ISO' => array('LIKE', '%') ), ), 'filters' => array( 'country_iso' => array( 'type' => 'country', 'description' => 'Country', 'where' => array( 'COUNTRY_ISO' => array('LIKE', '%'), ), ), 'ms' => array( 'type' => 'ms', 'description' => 'Member State', 'where' => array( 'MS' => array('LIKE', '%'), ), ), ), 'dynamic' => TRUE, 'editable' => FALSE, 'number' => 1, 'title' => "Payments and oustanding commitments in 2013 for Supplies<br><small>(Excluding visiting research teams and collaborations)</small>", 'subtitle' => "by country and by category of supplies", 'graph' => array( 'dynamic' => FALSE, ), 'headers' => array( array( 'from_db' => FALSE, // fixme: UNUSED 'layout' => array( 0 => array( 'colspan' => 11, 'class' => "text-center" ), 1 => array( 'rowspan' => 2, 'class' => "text-center border-left" ), 2 => array( 'rowspan' => 2, 'class' => "text-center border-left" ), ), 'data' => array( 0 => "<h3>Payments per activity code <small>(rounded kCHF)</small></h3>", 1 => "<h4>Industrial return<sup>2</sup><br><small>2013</small></h4>", 2 => "<h4>Return coefficient<br><small>2009 &ndash; 2012<!--<sup>3</sup>--></small></h4>", ), ), array( // fixme: unused 'from_db' => TRUE, 'layout' => array( 'SUPPLIES_1' => array( 'class' => "text-center" ), 'SUPPLIES_2' => array( 'class' => "text-center" ), 'SUPPLIES_3' => array( 'class' => "text-center" ), 'SUPPLIES_4' => array( 'class' => "text-center" ), 'SUPPLIES_5' => array( 'class' => "text-center" ), 'SUPPLIES_6' => array( 'class' => "text-center" ), 'SUPPLIES_7' => array( 'class' => "text-center" ), 'SUPPLIES_8' => array( 'class' => "text-center" ), 'SUPPLIES_9' => array( 'class' => "text-center" ), 'SUPPLIES_TOTAL' => array( 'class' => "text-center" ), 'SUPPLIES_RATIO' => array( 'class' => "text-center border-left" ), 'IR_PREV_YEAR' => array( 'class' => "text-center border-left" ), ), 'data' => array( 'MS' => FALSE, 'COUNTRY_ISO' => FALSE, 'COUNTRY_NAME' => "", 'SUPPLIES_1' => "1", 'SUPPLIES_2' => "2", 'SUPPLIES_3' => "3", 'SUPPLIES_4' => "4", 'SUPPLIES_5' => "5", 'SUPPLIES_6' => "6", 'SUPPLIES_7' => "7", 'SUPPLIES_8' => "8", 'SUPPLIES_9' => "9", 'SUPPLIES_TOTAL' => "Total", 'SUPPLIES_RATIO' => FALSE, 'IR_PREV_YEAR' => FALSE, ), ), ), 'body' => array( 'layout' => array( 'COUNTRY_NAME' => array( 'class' => "text-left" ), 'SUPPLIES_1' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_2' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_3' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_4' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_5' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_6' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_7' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_8' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_9' => array( 'class' => "text-right no-wrap" ), 'SUPPLIES_TOTAL' => array( 'class' => "text-center no-wrap" ), 'SUPPLIES_RATIO' => array( 'class' => "text-center border-left" ), 'IR_PREV_YEAR' => array( 'class' => "text-center border-left" ), ), 'format' => array( 'SUPPLIES_1' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_2' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_3' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_4' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_5' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_6' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_7' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_8' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_9' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_TOTAL' => array('format_french_number', 'format_no_decimals'), 'SUPPLIES_RATIO' => 'format_french_number', 'IR_PREV_YEAR' => 'format_french_number', ), ), // TODO: Implement footers with custom queries and formatting 'footers' => array( array( // fixme: unused 'from_db' => TRUE, // fixme: this is not used, and should go 'exclude' => array( 'MS' => "Others" ), 'layout' => array( 'COUNTRY_NAME' => array( 'class' => "text-right" ) ), 'data' => array( 'COUNTRY_NAME' => array( 'text' => "Sub-Total member states" ), 'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ), 'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ), 'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ), 'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ), 'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ), 'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ), 'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ), 'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ), 'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ), 'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ), 'SUPPLIES_RATIO' => false, 'IR_PREV_YEAR' => false, ), ), array( 'from_db' => TRUE, 'exclude' => array( 'MS' => "Others" ), 'layout' => array( '*' => array( 'class' => "text-italic text-bold" ) ), 'data' => array( 'COUNTRY_NAME' => "", 'SUPPLIES_1' => array( 'PERCENT' => array( 'SUPPLIES_1', 'SUPPLIES_TOTAL' )), 'SUPPLIES_2' => array( 'PERCENT' => array( 'SUPPLIES_2', 'SUPPLIES_TOTAL' )), 'SUPPLIES_3' => array( 'PERCENT' => array( 'SUPPLIES_3', 'SUPPLIES_TOTAL' )), 'SUPPLIES_4' => array( 'PERCENT' => array( 'SUPPLIES_4', 'SUPPLIES_TOTAL' )), 'SUPPLIES_5' => array( 'PERCENT' => array( 'SUPPLIES_5', 'SUPPLIES_TOTAL' )), 'SUPPLIES_6' => array( 'PERCENT' => array( 'SUPPLIES_6', 'SUPPLIES_TOTAL' )), 'SUPPLIES_7' => array( 'PERCENT' => array( 'SUPPLIES_7', 'SUPPLIES_TOTAL' )), 'SUPPLIES_8' => array( 'PERCENT' => array( 'SUPPLIES_8', 'SUPPLIES_TOTAL' )), 'SUPPLIES_9' => array( 'PERCENT' => array( 'SUPPLIES_9', 'SUPPLIES_TOTAL' )), 'SUPPLIES_TOTAL' => array( 'PERCENT' => array( 'SUPPLIES_TOTAL', 'SUPPLIES_TOTAL' )), 'SUPPLIES_RATIO' => false, 'IR_PREV_YEAR' => false, ), ), array( 'from_db' => TRUE, 'exclude' => array( 'MS' => "Member States", ), 'layout' => array( 'COUNTRY_NAME' => array( 'class' => "text-right" ) ), 'data' => array( 'COUNTRY_NAME' => array( 'text' => "Sub-Total other" ), 'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ), 'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ), 'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ), 'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ), 'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ), 'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ), 'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ), 'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ), 'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ), 'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ), 'SUPPLIES_RATIO' => false, 'IR_PREV_YEAR' => false, ), ), array( 'from_db' => TRUE, 'layout' => array( 'COUNTRY_NAME' => array( 'class' => "text-right" ) ), 'data' => array( 'COUNTRY_NAME' => array( 'text' => "Total" ), 'SUPPLIES_1' => array( 'SUM' => "SUPPLIES_1" ), 'SUPPLIES_2' => array( 'SUM' => "SUPPLIES_2" ), 'SUPPLIES_3' => array( 'SUM' => "SUPPLIES_3" ), 'SUPPLIES_4' => array( 'SUM' => "SUPPLIES_4" ), 'SUPPLIES_5' => array( 'SUM' => "SUPPLIES_5" ), 'SUPPLIES_6' => array( 'SUM' => "SUPPLIES_6" ), 'SUPPLIES_7' => array( 'SUM' => "SUPPLIES_7" ), 'SUPPLIES_8' => array( 'SUM' => "SUPPLIES_8" ), 'SUPPLIES_9' => array( 'SUM' => "SUPPLIES_9" ), 'SUPPLIES_TOTAL' => array( 'SUM' => "SUPPLIES_TOTAL" ), 'SUPPLIES_RATIO' => false, 'IR_PREV_YEAR' => false, ), ), ), 'html' => array( 'before' => $before, 'after' => $after, ), ); echo json_encode($table_template);
Output for 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
{"db":{"from":"PURCHASING_REPORT_TABLE_0","select":{"MS":false,"COUNTRY_ISO":false,"COUNTRY_NAME":null,"SUPPLIES_1":"###","SUPPLIES_2":"###","SUPPLIES_3":"###","SUPPLIES_4":"###","SUPPLIES_5":"###","SUPPLIES_6":"###","SUPPLIES_7":"###","SUPPLIES_8":"###","SUPPLIES_9":"###","SUPPLIES_TOTAL":"###","SUPPLIES_RATIO":"###","IR_PREV_YEAR":"###"},"where":{"MS":["LIKE","%"],"COUNTRY_ISO":["LIKE","%"]}},"filters":{"country_iso":{"type":"country","description":"Country","where":{"COUNTRY_ISO":["LIKE","%"]}},"ms":{"type":"ms","description":"Member State","where":{"MS":["LIKE","%"]}}},"dynamic":true,"editable":false,"number":1,"title":"Payments and oustanding commitments in 2013 for Supplies<br><small>(Excluding visiting research teams and collaborations)<\/small>","subtitle":"by country and by category of supplies","graph":{"dynamic":false},"headers":[{"from_db":false,"layout":[{"colspan":11,"class":"text-center"},{"rowspan":2,"class":"text-center border-left"},{"rowspan":2,"class":"text-center border-left"}],"data":["<h3>Payments per activity code <small>(rounded kCHF)<\/small><\/h3>","<h4>Industrial return<sup>2<\/sup><br><small>2013<\/small><\/h4>","<h4>Return coefficient<br><small>2009 &ndash; 2012<!--<sup>3<\/sup>--><\/small><\/h4>"]},{"from_db":true,"layout":{"SUPPLIES_1":{"class":"text-center"},"SUPPLIES_2":{"class":"text-center"},"SUPPLIES_3":{"class":"text-center"},"SUPPLIES_4":{"class":"text-center"},"SUPPLIES_5":{"class":"text-center"},"SUPPLIES_6":{"class":"text-center"},"SUPPLIES_7":{"class":"text-center"},"SUPPLIES_8":{"class":"text-center"},"SUPPLIES_9":{"class":"text-center"},"SUPPLIES_TOTAL":{"class":"text-center"},"SUPPLIES_RATIO":{"class":"text-center border-left"},"IR_PREV_YEAR":{"class":"text-center border-left"}},"data":{"MS":false,"COUNTRY_ISO":false,"COUNTRY_NAME":"","SUPPLIES_1":"1","SUPPLIES_2":"2","SUPPLIES_3":"3","SUPPLIES_4":"4","SUPPLIES_5":"5","SUPPLIES_6":"6","SUPPLIES_7":"7","SUPPLIES_8":"8","SUPPLIES_9":"9","SUPPLIES_TOTAL":"Total","SUPPLIES_RATIO":false,"IR_PREV_YEAR":false}}],"body":{"layout":{"COUNTRY_NAME":{"class":"text-left"},"SUPPLIES_1":{"class":"text-right no-wrap"},"SUPPLIES_2":{"class":"text-right no-wrap"},"SUPPLIES_3":{"class":"text-right no-wrap"},"SUPPLIES_4":{"class":"text-right no-wrap"},"SUPPLIES_5":{"class":"text-right no-wrap"},"SUPPLIES_6":{"class":"text-right no-wrap"},"SUPPLIES_7":{"class":"text-right no-wrap"},"SUPPLIES_8":{"class":"text-right no-wrap"},"SUPPLIES_9":{"class":"text-right no-wrap"},"SUPPLIES_TOTAL":{"class":"text-center no-wrap"},"SUPPLIES_RATIO":{"class":"text-center border-left"},"IR_PREV_YEAR":{"class":"text-center border-left"}},"format":{"SUPPLIES_1":["format_french_number","format_no_decimals"],"SUPPLIES_2":["format_french_number","format_no_decimals"],"SUPPLIES_3":["format_french_number","format_no_decimals"],"SUPPLIES_4":["format_french_number","format_no_decimals"],"SUPPLIES_5":["format_french_number","format_no_decimals"],"SUPPLIES_6":["format_french_number","format_no_decimals"],"SUPPLIES_7":["format_french_number","format_no_decimals"],"SUPPLIES_8":["format_french_number","format_no_decimals"],"SUPPLIES_9":["format_french_number","format_no_decimals"],"SUPPLIES_TOTAL":["format_french_number","format_no_decimals"],"SUPPLIES_RATIO":"format_french_number","IR_PREV_YEAR":"format_french_number"}},"footers":[{"from_db":true,"exclude":{"MS":"Others"},"layout":{"COUNTRY_NAME":{"class":"text-right"}},"data":{"COUNTRY_NAME":{"text":"Sub-Total member states"},"SUPPLIES_1":{"SUM":"SUPPLIES_1"},"SUPPLIES_2":{"SUM":"SUPPLIES_2"},"SUPPLIES_3":{"SUM":"SUPPLIES_3"},"SUPPLIES_4":{"SUM":"SUPPLIES_4"},"SUPPLIES_5":{"SUM":"SUPPLIES_5"},"SUPPLIES_6":{"SUM":"SUPPLIES_6"},"SUPPLIES_7":{"SUM":"SUPPLIES_7"},"SUPPLIES_8":{"SUM":"SUPPLIES_8"},"SUPPLIES_9":{"SUM":"SUPPLIES_9"},"SUPPLIES_TOTAL":{"SUM":"SUPPLIES_TOTAL"},"SUPPLIES_RATIO":false,"IR_PREV_YEAR":false}},{"from_db":true,"exclude":{"MS":"Others"},"layout":{"*":{"class":"text-italic text-bold"}},"data":{"COUNTRY_NAME":"","SUPPLIES_1":{"PERCENT":["SUPPLIES_1","SUPPLIES_TOTAL"]},"SUPPLIES_2":{"PERCENT":["SUPPLIES_2","SUPPLIES_TOTAL"]},"SUPPLIES_3":{"PERCENT":["SUPPLIES_3","SUPPLIES_TOTAL"]},"SUPPLIES_4":{"PERCENT":["SUPPLIES_4","SUPPLIES_TOTAL"]},"SUPPLIES_5":{"PERCENT":["SUPPLIES_5","SUPPLIES_TOTAL"]},"SUPPLIES_6":{"PERCENT":["SUPPLIES_6","SUPPLIES_TOTAL"]},"SUPPLIES_7":{"PERCENT":["SUPPLIES_7","SUPPLIES_TOTAL"]},"SUPPLIES_8":{"PERCENT":["SUPPLIES_8","SUPPLIES_TOTAL"]},"SUPPLIES_9":{"PERCENT":["SUPPLIES_9","SUPPLIES_TOTAL"]},"SUPPLIES_TOTAL":{"PERCENT":["SUPPLIES_TOTAL","SUPPLIES_TOTAL"]},"SUPPLIES_RATIO":false,"IR_PREV_YEAR":false}},{"from_db":true,"exclude":{"MS":"Member States"},"layout":{"COUNTRY_NAME":{"class":"text-right"}},"data":{"COUNTRY_NAME":{"text":"Sub-Total other"},"SUPPLIES_1":{"SUM":"SUPPLIES_1"},"SUPPLIES_2":{"SUM":"SUPPLIES_2"},"SUPPLIES_3":{"SUM":"SUPPLIES_3"},"SUPPLIES_4":{"SUM":"SUPPLIES_4"},"SUPPLIES_5":{"SUM":"SUPPLIES_5"},"SUPPLIES_6":{"SUM":"SUPPLIES_6"},"SUPPLIES_7":{"SUM":"SUPPLIES_7"},"SUPPLIES_8":{"SUM":"SUPPLIES_8"},"SUPPLIES_9":{"SUM":"SUPPLIES_9"},"SUPPLIES_TOTAL":{"SUM":"SUPPLIES_TOTAL"},"SUPPLIES_RATIO":false,"IR_PREV_YEAR":false}},{"from_db":true,"layout":{"COUNTRY_NAME":{"class":"text-right"}},"data":{"COUNTRY_NAME":{"text":"Total"},"SUPPLIES_1":{"SUM":"SUPPLIES_1"},"SUPPLIES_2":{"SUM":"SUPPLIES_2"},"SUPPLIES_3":{"SUM":"SUPPLIES_3"},"SUPPLIES_4":{"SUM":"SUPPLIES_4"},"SUPPLIES_5":{"SUM":"SUPPLIES_5"},"SUPPLIES_6":{"SUM":"SUPPLIES_6"},"SUPPLIES_7":{"SUM":"SUPPLIES_7"},"SUPPLIES_8":{"SUM":"SUPPLIES_8"},"SUPPLIES_9":{"SUM":"SUPPLIES_9"},"SUPPLIES_TOTAL":{"SUM":"SUPPLIES_TOTAL"},"SUPPLIES_RATIO":false,"IR_PREV_YEAR":false}}],"html":{"before":"","after":"<div class=\"table-legend\">\n\t<h4>Activity Codes key:<\/h4>\n\t<ol class=\"legend-list three-col\">\n\t\t<li>Civil engineering and buildings<\/li>\n\t\t<li>Electrical engineering and energy<\/li>\n\t\t<li>Electronics (including radiofrequency equipment)<\/li>\n\t\t<li>Computer systems and communication, including rental and maintenance<\/li>\n\t\t<li>Mechanical structures - Supplies &amp; manufacturing techniques<\/li>\n\t\t<li>Vacuum and low-temperature technology<\/li>\n\t\t<li>Particle detectors<\/li>\n\t\t<li>Miscellaneous (insurances, photoequipment, gases, vehicles, petrol, tools, furniture, office supplies, publications)<\/li>\n\t\t<li>Design studies - Miscellaneous supplies<\/li>\n\t<\/ol>\n\t<ul><li><sup>1<\/sup> Including commitments carried forward from previous years and excluding commitments for future years.\n\tRatio between the percentage of expenditure in an individual Member State for the above-mentioned period and that Member State's percentage contribution to the Budget <em>(TARGET for 2013: 0.91)<\/em>.<\/li>\n\t<li><sup>2<\/sup> Additional special contributions from France (excluding in-kind) and Switzerland were included in the calculation. Excluding individual purchase orders &lt; 1 000 CHF from 1 July 2013<\/li>\n\t<!--<li><sup>3<\/sup> See Table V of document <em>CERN\/FC\/5722\/RA<\/em><\/li>--><\/ul>\n<\/div>"}}
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.1, 5.1.3 - 5.1.6
Fatal error: Call to undefined function json_encode() in /in/cEuHU on line 262
Process exited with code 255.
Output for 5.1.2
Fatal error: Call to undefined function json_encode() in /in/cEuHU on line 264
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: json_encode() in /in/cEuHU on line 262
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.1, 4.4.3 - 4.4.4
Fatal error: Call to undefined function: json_encode() in /in/cEuHU on line 262
Process exited with code 255.
Output for 4.4.2
Fatal error: Call to undefined function: json_encode() in /in/cEuHU on line 264
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: json_encode() in /in/cEuHU on line 262

preferences:
364.26 ms | 401 KiB | 352 Q