3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data= '"CIEL3.SA",35.10,"SAO","+4.71%",+1.58,35.85,34.00,"34.00 - 35.85",8637900,"BRL","3/17/2016","5:08pm"'; $properties=explode(",",$data); $fields = array('Symbol', 'LastTradePriceOnly', 'StockExchange', 'ChangeinPercent', 'Change', 'DaysHigh', 'DaysLow', 'DaysRange', 'Volume', 'Currency', 'LastTradeDate', 'LastTradeTime'); foreach ($properties as $key=>$value) { $quotes[] = array ( $fields[$key] => $value ); }; $results = array ( "query" => array ( "results" => array ( "quote" => $quotes ) ) ); echo json_encode($results); $row = 1; $quotes = null; $stream = fopen('data://text/plain;base64,' . base64_encode($data),'r'); while (($data = fgetcsv($stream, 12, ",")) !== FALSE) { $num = count($data); echo "<p> $num campos na linha $row: <br /></p>\n"; $row++; foreach ($data as $key=>$value) { $quotes[] = array ( $fields[$key] => $value ); }; } $results = array ( "query" => array ( "results" => array ( "quote" => $quotes ) ) ); echo json_encode($results);
Output for git.master, git.master_jit, rfc.property-hooks
{"query":{"results":{"quote":[{"Symbol":"\"CIEL3.SA\""},{"LastTradePriceOnly":"35.10"},{"StockExchange":"\"SAO\""},{"ChangeinPercent":"\"+4.71%\""},{"Change":"+1.58"},{"DaysHigh":"35.85"},{"DaysLow":"34.00"},{"DaysRange":"\"34.00 - 35.85\""},{"Volume":"8637900"},{"Currency":"\"BRL\""},{"LastTradeDate":"\"3\/17\/2016\""},{"LastTradeTime":"\"5:08pm\""}]}}}<p> 2 campos na linha 1: <br /></p> <p> 11 campos na linha 2: <br /></p> {"query":{"results":{"quote":[{"Symbol":"CIEL3.SA"},{"LastTradePriceOnly":"3"},{"Symbol":"5.10"},{"LastTradePriceOnly":"SAO"},{"StockExchange":"+4.71%"},{"ChangeinPercent":"+1.58"},{"Change":"35.85"},{"DaysHigh":"34.00"},{"DaysLow":"34.00 - 35.85"},{"DaysRange":"8637900"},{"Volume":"BRL"},{"Currency":"3\/17\/2016"},{"LastTradeDate":"5:08pm"}]}}}

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
72.49 ms | 403 KiB | 8 Q