Here’s a simple tip to make your code more readable. Suppose you have:
$things = get_stuff(50, 25, true);
Unless you have the entire codebase memorized, you may not know what arguments are being passed into this function. But try this:
$things = get_stuff($start = 50,
$count = 25,
$include_soft_deletes = true);
Now it’s much more clear. You’re getting 25 things, starting at the 50th in the list. And you also seem to be including things that have been soft deleted (marked as deleted, but not actually removed). In PHP, an assignment expression evaluates to the value being set, so the above is a shortcut. But for languages that don’t allow this, or for those of use who know better than to get too clever, the following is just as good.
$start = 50; $count = 25; $include_soft_deletes = true; $things = get_stuff($start, $count, $include_soft_deletes);
A more general rule is to never use a number (or any value) without “labeling” it, and you label it by assigning it to a variable with a descriptive name.