View date_diff.php
$date1 = new \DateTime('2017-01-01');
$date2 = new \DateTime('2017-01-10');
$dateInterval = $date1->diff($date2); // this is not date1-date2, but date2-date1 :-(
var_dump($dateInterval->format('%r%a') > 3); // :-(
View telegram icon.txt
To convert this svg to web font – just upload `telegram-single-path*.svg` to service!
Use `telegram-source-240px.svg` as source file.
View ExcelCsvWriter.php
* require Yii2 for decimal formatter
class ExcelCsvWriter
* @var resource
The MIT License (MIT)
Copyright (c) 2015 Andrew Putilov
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

Что потребляет больше памяти в php: преинкремент или постинкремент?

Существует мнение, что преинкремент потребляет меньше памяти, т.к. он инкрементирует саму переменную, а постинкремент помимо этого, копирует ее предыдущее значение во временную переменную.

Давайте рассмотрим следующий код:

1. <?php
2. $a = 1;
3. echo $a++;
4. $b = 1;
View ConsoleProgress.php
use yii\base\Object;
use yii\helpers\Console;
* Usage:
* $consoleProgress = new ConsoleProgress(['max' => 365]);
* $consoleProgress->start();
* foreach($days in $day) {
View TruncateString.php
* @param string $string Subject
* @param int $length Max string length
* @param bool $exactLength Truncate string with exact $length
* @param string $append Ellipsis string
* @return string
class TruncateString
View InMemoryCache.php
class InMemoryCache
public $size = 10;
protected $cache = [];
* @param string $key
View AsteriskMatch.php
class AsteriskMatch
* @param string $mask string with asterisk
* @param string $string tested subject
* @return bool
* @throws \Exception
View OneInstance.php
namespace console\components;
use Yii;
use yii\base\ActionEvent;
use yii\base\Behavior;
use yii\base\Exception;
use yii\console\Controller;