Categories
Tags
Tag Archives: php
Ternary Conditional Syntax in PHP
The below two statements are equivalent. The first uses the ternary syntax and the second uses the more traditional verbose syntax. The condition should be a statement or variable that evaluates to true or false. true will be executed if the condition is met. false is executed if the condition fails. You could argue that […]
Calculating Median and Average w/ PHP
Here’s some handy functions for calculating the median or average of an array of numbers. The median is the number in the middle of an array of numbers, or when the number of items in the array is even, the median is the average of the two numbers that straddle the middle. The below was […]
Multi-Dimensional Array/Object Sort
I can never remember exactly how to accomplish this yet I need it all the time. This makes use of usort and a custom comparison function
Reset all user passwords in Joomla!
I found myself needing this script for some nonsense reason involving tech-averse users an an intranet. I decided to document it below for posterity. It’s real dirty, so use at your own risk.
Simple Mobile and Smartphone Detection
Though an old post, this is my solution that’s been pieced together from various comments on this article.