# remove php5 modules
apt-get autoremove --purge php5-*
# add php-7.0 source list by [Ondřej Surý](https://github.com/oerdnj)
add-apt-repository ppa:ondrej/php-7.0
# Update index
apt-get update
# Install php7.0-fpm with needed extensions
This file contains hidden or 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
| @startuml | |
| 'Как определить на какой стороне баг? | |
| (*) --> "Виден ли баг пользователю?" | |
| If "" then | |
| --> [Да] "Корректны ли данные запроса к серверу?" | |
| If "" then | |
| --> [Да] "Корректно ли отвечает сервер?" | |
| If "" then | |
| --> [Да] "Корректны ли данные в БД \nв результате обработки запроса сервером?" |
This file contains hidden or 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 quickSort($array) | |
| { | |
| // base recursion case | |
| if (count($array) <= 1) { | |
| return $array; | |
| } | |
| // select first element as pivot point |
This file contains hidden or 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
| #!/bin/bash | |
| while :; do sleep 10; done |
This file contains hidden or 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 bubble(array &$array) | |
| { | |
| $elementsNumber = count($array); | |
| for ($min = 0; $min < $elementsNumber - 1; $min++) { | |
| $least = $min; | |
| for ($j = $min + 1; $j < $elementsNumber; $j++) { |
This file contains hidden or 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 | |
| $mysqlTypes = [ | |
| // INTEGER | |
| // byte — кол-во байт на хранение, | |
| // max/min — предельные значения, | |
| // umax/umin — беззнаковые предельные значения | |
| 'int' => ['byte' => 4, 'min' => -2147483648, 'max' => 2147483647, 'umin' => 0, 'umax' => 4294967295], | |
| 'bigint' => [ | |
| 'byte' => 8, |
This file contains hidden or 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
| Низкая скорость из-за парсинга и компиляции в момент вызова функции; | |
| Не используется кэш байткода; | |
| Ограничен доступ к локальным переменным и пространствам имён; | |
| Не поддерживается компиляторами, типа HipHop; | |
| Не понятно что там с обработкой ошибок, возникших внутри eval-кода. |
This file contains hidden or 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 | |
| /** | |
| * Class for random string generation which can be used as id. | |
| * Examples: | |
| * $id = IdGenerator::generate(); // generates 8-symbol id | |
| * $id = IdGenerator::generate(32); // generates 32-symbol id | |
| * @author Vehsamrak | |
| */ | |
| class IdGenerator |
This file contains hidden or 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 uuid() | |
| { | |
| return sprintf( | |
| '%04x%04x-%04x-%04x-%04x-%04x%04x%04x', | |
| // 32 bits for "time_low" | |
| mt_rand(0, 0xffff), | |
| mt_rand(0, 0xffff), |
This file contains hidden or 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
| ## Scaling image | |
| #### Usage: | |
| ``` | |
| $imageProcessor = new ImageProcessor(); | |
| $imageProcessor->load($filePath); | |
| $imageProcessor->resizeToHeight(100); | |
| $imageProcessor->save($filePath);` | |
| /** | |
| * Class for image file operations: |