Client-server encryption-decryption using Advanced Encryption Algorithm (AES) in client and server is complicated because exactly the same algorithm must be implemented twice: once for client side in JavaScript and once for server side in PHP,C# etc.
Continue reading
Tag Archives: php
PHP Console – a new must-have php debugging tool
PHP Console is a debugging tool for PHP that writes debug info to Chrome debugging console. It was recently updated to the version 3 and has a lot of new nice features now.
There is a similar debugging tool FirePHP that does the same job with Firefox and FireBug.
Continue reading
How to change location of the pear.ini for php 5.4 and 5.5 on Windows
When PEAR installs itself on Windows it places pear.ini file in the system folder c:\Windows
by default. Which sometimes needs to be changed after all. And sometimes it is not possible for some reasons (not sure why, probably a bug in PEAR installation scripts) to change this location during the installation. Then we need to change this location when PEAR is already installed and in use.
Continue reading
How to install PEAR on Windows
There was a PEAR installer go-pear.bat
that referred to ./PEAR/go-pear.phar
in php versions prior to 5.3 on Windows. But since version 5.3 this installer is absent. Strange enough but official PEAR installation guide still refers to the absent go-pear.bat
file. But then it writes about update of PEAR installation by requesting a new go-pear.phar
and that is what we should actually do at the beginning.
Continue reading
What is new in php 5.6. Variadic functions and namespaced functions
The next major php release is 5.6. Here are two new abilities already accepted by php community to be included into language from version 5.6.
Continue reading
PHP extension collections links
PHP extensions collections
http://windows.php.net/downloads/pecl/releases
https://github.com/stealth35/stealth35.github.com/downloads
http://www.hmelihkara.com/files/php_sqlsrv_55.rar
WinCache – Windows Cache Extension
XCache – binary downloads for Windows
How to read directory in PHP fast
We need to get a list of specific files from a directory.
Say we need to find all *.php files in our c:\inetpub\wwwroot folder. There are a couple of options to do it in PHP: opendir(), glob(), scandir() and RecursiveDirectoryIterator class. If we need to search through subfolders then the simplest solution in my opinion is to use the RecursiveDirectoryIterator class. Continue reading
How to show PHP code in TeamCity build
Use case: As a developer I want to see PHP source code in TeamCity build.
It is quite useful sometimes to observe code that used for build and tests of a project.
Continue reading
How to create mock for a method with reference parameters
While testing PHP we need sometimes to create a mock for a method with reference parameters. I use returnCallback() from PHPUnit framework to to this. returnCallback() will call a function that imitates functionality of the original method. The original method can be either public or protected.
Continue reading
How to iterate date and time in PHP
We need to iterate date and time between two predefined time moments with a predefined time step.
For example 30 minutes step
$start = new \DateTime(...); $end = new \DateTime(...); for ($temp=$start; $temp<=$end; $temp->add(new \DateInterval('PT30M'))) {..}
1 day step
for ($temp=$start; $temp<=$end; $temp->add(new \DateInterval('P1D'))) {..}