Permalink
Browse files

Create developer_tips.md

  • Loading branch information...
tbar0970 committed Aug 17, 2016
1 parent 33fad88 commit f0218e3078c94b3c1abfaa5a191f623dba080881
Showing with 8 additions and 0 deletions.
  1. +8 −0 docs/developer_tips.md
View
@@ -0,0 +1,8 @@
## Useful Helper Functions
* _array_get($array, $index, $fallback)_ - if $array[$index] is set, it's returned; otherwise $fallback is returned. Particularly useful when dealing with $_REQUEST.
* _ifdef($constantName, $fallback)_ - if a constant is defined with name $constantName, it's returned; otherwise $fallback is returned.
## Tips
* Remember the _empty()_ function can handle non-set array elements without erroring. So we can do `if (empty($_REQUEST['something']))` will efficiently test whether the element is non-set, blank string, false, null, zero etc.
* Don't include a close-php tag at the very end of a file. Can cause problems with outputting whitespace.

0 comments on commit f0218e3

Please sign in to comment.