Today I’m coming with a setting for Yii2, as I haven’t found any documentation about this. So we will set up advanced template of Yii, on a Directadmin server, running on nginx. First of all, you need to install Yii2 – you can do it as you like, via composer or regular installation. This step is very well… Read More »
Inspired from Github If you have links, that might end with slashes (sometimes they are being added automatically), you won’t be able to handle them unless you add a string to your Yii2 project configuration. Since version 2.0.10 UrlManager can be configured to handle trailing slashes in a simple way. Just make sure your config file has normalizer… Read More »
Today just a simple command. If you need to know the current query for an Activerecord object, you need this simple command: This will show current SQL query. Another solution is:
Sometimes users need to send outgoing e-mails with external SMTP servers. Most popular example is PHPMailer with its ability to use free SMTP servers, for example Gmail. Here is the short piece of code, that allows to do this: If you have a Directadmin server with csf firewall installed, most probably you will get this message on execution:… Read More »
Sometimes you need to avoid using cURL for getting external web content for any reasons. You’re lucky that PHP has some built-in functions that allow you to get data from the Web without cURL. But if you are using default values, there is no option to set the timeout for a operation and it’s sometimes annoying. In order… Read More »
If you have used Hesk before, you must have mentioned that all links that were posted by users at the time of ticlet creation/reply were opening in new tabs. If you decide to update to 2.5.2 (I was using version 2.3 before), you will notice that all links will be opening in the current tab. If you want… Read More »
After another PHP recompilation I’ve started getting the following error while trying to access SSL websites with cURL: 56 SSL read: error:140940E5:SSL routines:SSL3_READ_BYTES:ssl handshake failure, errno 0 What does this mean and how to solve this issue? This means your cURL installation is trying to use the wrong number of SSL protocol. All you need to resolve this… Read More »
If you have an array with duplicate values, sometimes you might need to show only non-unique elements. Here is a short code in PHP that will allow you to do this. <? $arr=array_map(“trim”, file(“file.txt”)); $nonuniq=array_unique(array_diff_assoc($arr, array_unique($arr))); ?> This will return unique array of duplicates. If you need to show all duplicated values, use this code. <? $arr=array_map(“trim”, file(“file.txt”));… Read More »
Just wanted to paste a PHP solution for a Paypal refund. It was found on Paypal official site, but I spent some time to get it.
You can count the number of substring occurrences using Regexp-based functions, but if you don’t want to deal with them, that seems to be the fastest option for case insensitive substr_count.