PHP: Use the ternary operator in PHP
A good program is sometimes equalized with few lines of code. But how do we program this way? One step is using the ternary operator...
Den ganzen Beitrag lesen...
A good program is sometimes equalized with few lines of code. But how do we program this way? One step is using the ternary operator...
Den ganzen Beitrag lesen...
I found this article about password hashing in PHP on Twitter and found a few serious points that are not fully correct in this article.
Den ganzen Beitrag lesen...
I created this class because there are too many people still saving simple md5 instead of more secure hashes.
The class should be fully PHP4 and PHP5 compatible and very easy to use. But also extended usage on its complex methods is possible.
The usage of the class should be straight forward.
If you just want to use it, use the methods hash() and check().
EXAMPLE:
That is all you need to know for just using it, but i have to tell, you will miss something important if you stop reading here.
Den ganzen Beitrag lesen...
After using Twitter some time now, i saw several URL shortening services and a few scripts that would do the work. But i did not see any PHP Class for doing this job easily. So i wrote one myself ...
Den ganzen Beitrag lesen...
I once wrote a article about APC and MySQL MEMORY table caching and found out that APC needs very much memory compared to MySQL MEMORY. Now i did a short benchmark to check out the fetching speed of these two solutions with a interesting result.
Den ganzen Beitrag lesen...
This is the best PHP bug rebot EVER! Just read it:
http://bugs.php.net/bug.php?id=48669
Den ganzen Beitrag lesen...
The Twitter user caioariede postet that you should array_key_exists() instead of isset(). He did not say why so i tried to check performance first and came to interesting results...
Den ganzen Beitrag lesen...
PHP has just one kind of array, it does not have separate lists, hash or maps, they are all combined in a "array". Iterating over such a array is a very common part so doing it wrong can lead to less performance.
In the following article i will do a short test which loop is the fastest.
Den ganzen Beitrag lesen...
With the Realease of PHP 5.3 have come very much little new details, on of them is the short ternary operator wich annoyed me for a long time because you have to use it with 3 subjects.
Before PHP 5.3.0 this was the only way it could be done:
Now in PHP 5.3.0 you can write:
There is one problem i see here.
I cant use this in my public projects because it will make my code >= PHP 5.3 dependent wich is NOT an Option. But this mixed with the fact that namespaces are now available with PHP 5.3, it will my namespaced code always PHP 5.3 dependent.
Bei einem aktuellen Projekt wurde APC eingesetzt um tausende kleinere Variablen zu cachen da es sich nicht lohnen würde diese in einer persistenten Datenbank zu speichern. Da der 30MB große APC Cache jedoch recht schnell voll wurde habe ich ein paar Nachforschungen angestellt, dabei bin ich zu dem Schluss gekommen dass APC für das Speichern von einzelnen kleinen Variablen viel zu viel Speicher verschwendet.
Den ganzen Beitrag lesen...