×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: PHP
Posted by: IGA JOHN BOSCO
Added: May 22, 2017 7:00 AM
Views: 13
Tags: no tags
  1. <?php
  2.  
  3. #font awesome icons function
  4.  
  5. function i($code) {
  6.         $icon = '<i class="fa fa-'.$code.' "></i>';
  7.         return $icon;
  8. }
  9.  
  10. #clean the start date
  11.  
  12. function date_nice($date) {
  13.         return date('M j Y g :i A', $date);
  14. }
  15.  
  16. #clean the time end time
  17.  
  18. function time_nice($seconds) {
  19.         $h = floor(($seconds/60)/60);
  20.         $m = round(($seconds/60)-($h*60));
  21.         return $h.' Hrs : '.$m.' Mins ';
  22. }
  23.  
  24. #write to file data
  25.  
  26. function save($data) {
  27.         $json = json_encode($data);
  28.         $file = fopen('data.json', 'w');
  29.         fwrite($file, $json);
  30. }
  31.