Skip to content

Instantly share code, notes, and snippets.

@elmaxid
elmaxid / timing.php
Created March 15, 2019 18:01
Calcula los tiempos de ejecución
<?php
/*
https://www.if-not-true-then-false.com/2010/php-timing-class-class-for-measure-php-scripts-execution-time-and-php-web-page-load-time/*/
class Timing {
private $break;
private $start_time;
@elmaxid
elmaxid / dateDiff.php
Created March 15, 2019 17:59
diferencia de tiempo entre dos fechas
<?php
/*https://www.if-not-true-then-false.com/2010/php-calculate-real-differences-between-two-dates-or-timestamps/*/
// Set timezone
date_default_timezone_set("UTC");
// Time format is UNIX timestamp or
// PHP strtotime compatible strings
function dateDiff($time1, $time2, $precision = 6) {
// If not numeric then convert texts to unix timestamps
if (!is_int($time1)) {
@elmaxid
elmaxid / colors_cli.php
Created March 15, 2019 17:54
console cli with colors with PHP
<?
/*
From :
https://www.if-not-true-then-false.com/2010/php-class-for-coloring-php-command-line-cli-scripts-output-php-output-colorizing-using-bash-shell-colors/
with fixes by me
*/
$colors = new Colors();