This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function arrayToTable(array $rows, string $tableAttributes = ''): string | |
{ | |
if (!$rows) { | |
return ''; | |
} | |
$rowsHeaders = array_keys($rows[0]); | |
$table = "<table {$tableAttributes}><tr>"; | |
foreach ($rowsHeaders as $rowsHeader) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function ISO8601ToSeconds($ISO8601){ | |
$interval = new \DateInterval($ISO8601); | |
return ($interval->d * 24 * 60 * 60) + | |
($interval->h * 60 * 60) + | |
($interval->i * 60) + | |
$interval->s; | |
} | |
function ISO8601ToMinutes($ISO8601){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Takes in a filename and an array associative data array and outputs a csv file | |
* @param string $fileName | |
* @param array $assocDataArray | |
*/ | |
public function outputCsv($fileName, $assocDataArray) | |
{ | |
ob_clean(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function decompact(...$params) | |
{ | |
$minimumParamsForNewLines = 4; | |
$newLine = "\n"; | |
if (count($params) < $minimumParamsForNewLines) { | |
$newLine = ''; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<? | |
$time_start = microtime(true); | |
//Your Content (i use sleep 2 seconds to for demo) | |
sleep(2); | |
$time_end = microtime(true); | |
$time = $time_end - $time_start; | |
echo 'Page generated in: '.$time.' seconds'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Add 1 year | |
$future = date('Y-n-j', mktime(0,0,0, date('m'), date('d'), date('Y')+1)); | |
echo $future; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$time_start = microtime(true); | |
//Your Content (i use sleep 2 seconds to for demo) | |
sleep(2); | |
$time_end = microtime(true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Youtube Iframe load on thumb click</title> | |
<style> | |
.youtube { | |
position: relative; | |
padding-bottom: 56.25%; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<iframe id="player" type="text/html" width="640" height="390" | |
src="https://www.youtube.com/embed/8tEyAAniu5U?enablejsapi=1" | |
frameborder="0"></iframe> | |
<iframe id="player2" type="text/html" width="640" height="390" | |
src="https://www.youtube.com/embed/pt8VYOfr8To?enablejsapi=1" | |
frameborder="0"></iframe> | |
<script> |