You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');| <?php | |
| /** | |
| * Convert a comma separated file into an associated array. | |
| * The first row should contain the array keys. | |
| * | |
| * Example: | |
| * | |
| * @param string $filename Path to the CSV file | |
| * @param string $delimiter The separator used in the file | |
| * @param boolean $asHash Use header row as keys in the returned array |
| function my_tracking_code() { | |
| echo 'Paste tracking code from Google Analytics here'; | |
| } | |
| add_action( 'wp_footer', 'my_tracking_code' ); |
| <?php | |
| $zip = new ZipArchive; | |
| if(isset($_POST['submit'])){ | |
| $zip->open('zipfile.zip'); | |
| $zip->extractTo('./'); | |
| $zip->close(); | |
| } |
| #secure the login page | |
| ErrorDocument 403 /path-dummy-returns404/index.php?error=404 | |
| <Files wp-login.php> | |
| order deny,allow | |
| Deny from all | |
| # Allow this IP address | |
| allow from 123.123.444.44 | |
| </Files> |
| <?php | |
| //string to lowercase | |
| $text = strtolower('HELLO WORLD'); | |
| //converts the first character of each word in a string to uppercase | |
| echo ucwords($text); |
| <?php | |
| if ( empty($f_ar[1]) ) $f_ar[1] = 'date'; |
| <?php | |
| //input @param $var : empty variable (string); @param $new_var (set new variable) | |
| function empty_var($var,$new_var){ | |
| if ( empty($var) ) $var = $new_var; | |
| return $var; | |
| } | |
| // credits https://gist.github.com/JeffreyWay/3194444 |
You know how, in JavaScript, we can set a value to a variable if one doesn't, like this:
name = name || 'joe';This is quite common and very helpful. Another option is to do:
name || (name = 'joe');[510-pop]PL2HEDIx6Li8jqhOAi7wQb18wXQ3oeLAO8 [150-urban-pop]PL4o29bINVT4GjAQ-X5D0d34p8V99NFPF8 [1,100-hiphop]PLHmhZG6IDkRAyFay7Nzoy3YE7QLUbQVu3 [305-mtvhits]PLsDLZYdI9YpaLHCOJ0LHh3uP5ZqC3ArQx
adjective adjective: foolproof; adjective: fool-proof
incapable of going wrong or being misused.
"a foolproof security system"