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("http://download.finance.yahoo.com/d/quotes.csv?s=CIEL3.SA&f=sl1xp2c1hgmvc4d1t1", "r"); //$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
{"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\""}]}}} Warning: fopen(): php_network_getaddresses: getaddrinfo for download.finance.yahoo.com failed: System error in /in/UblO4 on line 28 Warning: fopen(http://download.finance.yahoo.com/d/quotes.csv?s=CIEL3.SA&f=sl1xp2c1hgmvc4d1t1): Failed to open stream: php_network_getaddresses: getaddrinfo for download.finance.yahoo.com failed: System error in /in/UblO4 on line 28 Fatal error: Uncaught TypeError: fgetcsv(): Argument #1 ($stream) must be of type resource, bool given in /in/UblO4:30 Stack trace: #0 /in/UblO4(30): fgetcsv(false, 12, ',') #1 {main} thrown in /in/UblO4 on line 30
Process exited with code 255.
Output for 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\""}]}}} Warning: fopen(): php_network_getaddresses: getaddrinfo for download.finance.yahoo.com failed: System error in /in/UblO4 on line 28 Warning: fopen(http://download.finance.yahoo.com/d/quotes.csv?s=CIEL3.SA&f=sl1xp2c1hgmvc4d1t1): Failed to open stream: php_network_getaddresses: getaddrinfo for download.finance.yahoo.com failed: System error in /in/UblO4 on line 28 Fatal error: Uncaught TypeError: fgetcsv(): Argument #1 ($stream) must be of type resource, false given in /in/UblO4:30 Stack trace: #0 /in/UblO4(30): fgetcsv(false, 12, ',') #1 {main} thrown in /in/UblO4 on line 30
Process exited with code 255.

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:
50.35 ms | 402 KiB | 8 Q