Skip to content

Category Archives: PHP

Get next auto_increment value in MySQL

I was recently working on some MySQL 5.5 performance testing. I had to generate a lot of SQL queries I would then use for my testing. To make my tests repeatable I needed to hardcode the values for IDs. That is, I couldn’t simply use: INSERT INTO TABLE_NAME SET column1 = ‘value1′; because this query [...]

Symfony 2 Dependency Injection as a standalone component

Setup Below I will demonstrate how to use an excellent Dependency Injection component from Symfony 2, without using the whole Symfony framework. I will also use ClassLoader from Symfony and just for the sake of the demo I will integrate it with Zend Framework. The code requires PHP 5.3 (mostly for namespaces support). Create a [...]

Using shared memory in PHP

PHP provides a handy support for System V IPC functions in the Semaphore module. Let’s have a look at the functions responsible for handling shared memory. They can be used to implement a simple way of exchanging information between the processes. To see if your PHP installation supports IPC, run: % php -i | grep [...]