This article is intended to those who wish to install Redis and PHP extension for interfacing with Redis on their XAMPP installation on windows. As I had required once to setup a Redis Server on my local development machine and utilize it as it was not possible to test on a production environment.
Have you ever used a function call in `empty()` for an `if` condition to perform some checking? Then you might come up with an PHP fatal error saying Can’t use method return value in write context. I am explaining here why did the error come and 2 ways to write them correctly.
In PHP we either create objects and their array, or database returns array of objects as result-set of some query. There we might need to find an object which have a particular property-value pair. There is no direct function available in PHP to perform the same so I’m explaining here how can we find object by value in array of objects by using a foreach loop.
Sometimes we create MySQL tables which don’t contain auto increment primary key column instead they may have unique key or combination of unique indexes. In such tables we wish to insert a new row if primary/unique key or keys combination doesn’t exists and update record if exists.
As responsive design has come into trends, I decided to write this post to display Data in Responsive Columns from Database using PHP. Like the image below, a product catalog would be good example of this where columns adjust them automatically to maintain responsiveness with different screen sizes.
While working with array in PHP sometimes we need to check if a value exists in an array and delete that key and value together from array. This simple code snippet below with explanation will help you to understand how can you delete element by value from array (not by key).
Generally We use Captcha in the form to ensure that the form is submitted with manual intervention without any tools or programs. In this article we will show captcha using jQuery from PHP. Using jQuery we can also refresh the captcha code by resending AJAX call to generate new captcha image.
Displaying a star ranking system is a common requirement to implement in websites. We have explained here how can we show a group of stars for each database record and dynamically apply 5 star rating in PHP with AJAX and jQuery. You can make AJAX calls to store rating of the record in database.
Sometime we face a unique type of problem during development and we watch the code thoroughly but not find the error where we are getting. ‘Only variables should be passed by reference‘ in $file_extension = end(explode(‘.’, $file_name)) is the same type of problem which does not seem as error in our code and it happens in usual code.
Like in a WordPress website, photos added in posts inside dashboard post editor are kept in dynamically generated year months directories inside wp-content/uploads directory by default. This blog will assist you to make directory in PHP and we will then create year months folders at our server.