In this PHP tutorial, I’m providing 5 functions to get array values by keys. We have an associative array and an indexed array of few keys. Further, we want to get an array that has matched keys from the indexed array and corresponding values from the associative array. Conversely, we might wish to return an array with […]
Tag » Loop
5 Ways – Equal Height Columns or Parent Div to Maximum from Children
Create equal height columns in a webpage. Or set parent div height to the maximum from children. Equalizing the height of divs assist to obtain a grid/column layout. Also, the same can fix the varying height issue due to rotation of sibling elements in a parent like a slider.
MySQL update if value is greater than current value
While working with MySQL database there might be situation when you wish to update certain column only if the value being updated is greater than existing value or current value stored in that column. MySQL GREATEST and LEAST functions are quite handy in such situations. Let’s see how can we use first function to update a column if value is greater than current value.
Find object by value in array of objects
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.
Display Data in Responsive Columns from Database using PHP
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.
Loop in wordpress
In every programming or script language, loops structure has its own importance. Generally Wordpress follows PHP. But wordpress also has some specific ways to achieve loops functionality.
PHP return data from loop in function
The idea behind writing a post to return data from loop in function in PHP just came into my mind because a fresher was trying to set up a function to return data from loop and hoping it would then run a return each time within the loop and the function would echo each out one by one.