- ternary vs coalescing null operator
- checks for null values
- example:
echo isset($item_name) ? $item_name : NULL;
echo $item_name ?? NULL; - ternary vs elvis operator (ternary shorthand)
- checks for truthy values
- example:
echo !empty($item_name) ? $item_name : NULL;
echo $item_name ?: NULL; - using ternary vs (coalescing null operator & elvis operator)
- example:
echo isset($item_name) && !empty($item_name) ? $item_name : ‘default’;
echo $item_name ?? $item_name ?: ‘default’; - spaceship operator
- used to compare 2 values and returns either -1,0,1. mostly used to compare dates
- example:
var_dump(1 <=> 2); // returns int(-1)
var_dump(1 <=> 1); // returns int(0)
var_dump(2 <=> 1); // returns int(1)
🗑️ Clear storage Mac OS 1: Clear system cache: Go to Finder > Go > Go to Folder, then type in "~/Library/Caches" and hit enter. Select all the folders inside the Caches folder and delete them. 2: Clear system logs: Go to Finder > Go > Go to Folder, then type in "/var/log" and hit enter. Select all the files inside the Log folder and delete them. 3: Remove unused language files: Go to Finder > Go > Go to Folder, then type in "/Library/Languages" and hit enter. Delete all the language folders you don't need. 4: Uninstall unused apps: Go to the Applications folder and delete the apps you don't use. 5: Clean up system files: Use a system cleaning tool like CleanMyMac X to scan and remove unnecessary system files. 6: If you have npm installed, clear the caches once in a while with ‘sudo npm cache clean --force’ 7: If you have ionic projects, open the ‘.angular’ folder and delete the ‘cache’ folder inside it.
Comments
Post a Comment