PHP Cheat Sheet
Merge two arrays, retain unique values
Append values from second array.
Do not care about keys.
<?php $array1 = [ 0 => 'apple', 1 => 'orange', 2 => 'pear', ]; $array2 = [ 0 => 'melon', 1 => 'orange', 2 => 'banana', ]; $result = array_keys( array_flip($array1) + array_flip($array2) ); ?> Result: [ [0] => "apple", [1] => "orange", [2] => "pear", [3] => "melon", [4] => "banana", }
Apache Config Options / .htaccess
error_reporting calculator:
- http://www.bx.com.au/tools/ultimate-php-error-reporting-wizard
- https://maximivanov.github.io/php-error-reporting-calculator/
Bash / Packages / Version
Get list of installed php packages:
- dpkg --get-selections | grep ^php | cut -f 1 | tr '\n' ' '
- dpkg --get-selections | grep ^php | cut -f 1 | tr '\n' ' ' | sed "s/7.0//g" | sed "s/php/php7.4/g"