The basic question is: why should we use this type of library and why not use the float type instead? The problem is that computers are not able (and have never been) to handle floating point values with real accuracy. While for some insignificant data this should not be a problem, in the case of recalculating the amounts of money-related transactions, it is already a serious concern. This library frees us from issues related to currency operations, storing them (or just preparing for it), adding or converting. All this without fear about lack of precision.
I must sometimes modify images and PDF documents in PHP. Prepare them to display after user upload, prepare for database, fix dimensions or many other things. Of course we can use native PHP functions, but it’s very slow. Better option is to use external libs like convert (ImageMagick) and Ghostscript. Today I have some useful convert commands – it’s “list to remember” for me, but maybe also you will find someting nice? This post is short, because I paste only commands and very short description.
I’ve written one post about MongoDB and PHP about creating nested set model in this database, but there is another interesting topic: using JOINs in mongo queries. Sorry, wh… what? Joining tables in non-relational database? Yes, it’s possible and we can do this to collect much more data in only one, but more complicated query. Let’s start to see how we can achieve this.
Few weekes ago I wrote about custom view plugins in Zend Framework. It’s great solution to separate and re-use code for our templates, build simple functions for menus, thumbnails etc. But… what about similar situation in controller? Yes, it’s possible to use view helpers in controllers, but it isn’t good. Creating controller plugin is much better option and we can do that in Zend Framework. Let’s try.
In the old, polish version of this blog, there are several posts about nginx server and PHP configuration. These entries are outdated now, but I will be writing them again in english soon. Meanwhile, today I would like to briefly share information on the ondemand mode in PHP-FPM. I have to used it and think it’s the best solution for most configurations.