This on r/programming today: What’s New in PHP 8.
To generate an SSL private key for use with MySQL/MariaDB and PDO:
openssl genrsa -out client-key.pem 4096
I read Everything you need (and don’t need) to know about PHP’s type system, it was interesting. My favourite quote was at the end:
“I believe php’s type system is incredibly rich and carries many innovative and legacy features and they all make much sense when you look at the history of the language development.”
Today I had cause to read about Operator Precedence in PHP. I think I will consider availing myself of the ‘and’ and ‘or’ keywords in future, I haven’t used them myself, although I have seen them before.
It’s very important to remember that PHP caches results of file-system functions. Details are here.
I enjoyed reviewing 10 Popular PHP frameworks in 2020.
Today I learned about mb_strimwidth, very handy in a tight spot. It’s worth a review of the sidebar for other multibyte string options.
I found an interesting article: Linux 25 PHP Security Best Practices For Sys Admins
So to enable profiling on the command line run your script in PHP like this:
php -d xdebug.profiler_enable=1 /path/to/script.php
You need to have configured xdebug in php.ini, I do it with a file in
/etc/php/7.2/cli/conf.d/xdebug.ini that looks like this:
;xdebug.profiler_enable = 0 xdebug.profiler_output_dir = "/tmp/xdebug" xdebug.profiler_output_name = "cachegrind.out.%p"
Note: you can enable profiling for all scripts with xdebug.profiler_enable = 1
So I was reading output from
and I couldn’t read it easily because the numbers weren’t formatted with thousands separators and I figured I could fix that…
I give you numformat.php. It automatically reformats any input that looks like a number…
There’s more info on the programming@progclub mailing list.