Sunday, 2 July 2017

Code Playgrounds

Typical features of these online playgrounds include:
  • color-coded HTML, CSS and JavaScript editors
  • a preview window — many update on the fly without a refresh
  • HTML pre-processors such as HAML
  • LESS, SASS and Stylus CSS pre-processing
  • inclusion of popular JavaScript libraries
  • developer consoles and code validation tools
  • sharing via a short URL
  • embedding demonstrations in other pages
  • code forking
  • zero cost (or payment for premium services only)
  • showing off your coding skills to the world!


With PHP support:
<!DOCTYPE html>
<html lang="en">
<head>
 <meta charset="UTF-8">
 <title>readContactCSV.php</title>
</head>
<body>
 <h1>Contacts</h1>
 <div>
 <?php
  print <<< HERE
  <table border = "1">
  <tr>
   <th>First</th>
   <th>Last</th>
   <th>email</th>
   <th>phone</th>
  </tr>
HERE;
  $data = file("contacts.csv");
  foreach ($data as $line){
  $lineArray = explode(" ", $line);
  list($fName, $lName, $email, $phone) = $lineArray;
  print <<< HERE
   <tr>
   <td>$fName</td>
   <td>$lName</td>
   <td>$email</td>
   <td>$phone</td>
   </tr>
HERE;
  } // end foreach
  //print the bottom of the table
  print "</table> \n";
 ?>
 </div>
</body>
</html>

No comments:

Post a Comment