Arrays in PHP

Some notes about arrays in PHP over here: PHP: Frankenstein arrays. I was already aware of most of that but I thought the notes at the bottom about supporting JSON were handy:
If you want to enforce an array to encode to a JSON list (all array keys will be discarded), use:


And if you want to enforce an array to encode to a JSON object, use:


Also array_is_list is available as of PHP 8.1.

Mysticism and Morality

From 1.4.9. – Mysticism and Morality – Pt. 1:

Now, you see, I’m not talking about a philosophy, I’m not talking about a rationalization, some sort of theory that somebody cooked up in order to explain the world and make it seem a tolerable place to live in. I’m talking about a rather whimsical, unpredictable experience that suddenly hits people, and it includes this element of feeling the total harmoniousness of everything.

How to check which process is causing IO wait

The ‘wa’ state in `top` can indicate an IO wait, but to figure out what’s causing the IO wait try this command:

# ps aux | awk '$8 ~ /D/  { print $0 }' | less

You can read more here. Thanks to bsandro on #lobsters.
According to `man top`:

The status of the task can be one of:
  D = uninterruptible sleep
  I = idle
  R = running
  S = sleeping
  T = stopped by job control signal
  t = stopped by debugger during trace
  Z = zombie