Passing Parameters as Variables vs Passing Parameters as An Array

Posted by admin in Wordpress Tips, Word... | 02.26.2010 - 3:14 am

Improvisation is the name of the game, and we tend to do a lot of it with plugins and themes. In that process we tend to modify functions by adding more variables to incorporate changes in them. However, unlike most of the other languages, PHP allows users to set default values for variables passed to a method too.
As a developer when you start out coding, you have a certain number of things a function will require in order for it to work, some may be optional too, so you set out to create a method signature similar to the one below.
function do_something($var1, $var2, $var3, $var4 = false, $var5 = ”)  {
//process business logic here
}
Now, say you release your plugin or theme and get more feedback on features and other improvements. If the features or improvements suggested require you to change the method signature to incorporate new variables and […]

Original post by Keith Dsouza

    Technorati Tags: ,

    Related Posts:
  1. Photo Album Plugin Vulnerabilities
  2. ...
  3. 3D Spiral Component Giveaways
  4. ...
  5. WordPress Lingo
  6. ...
  7. Adding Menus To The Admin Bar
  8. ...
  9. All In One SEO Pack for Windows Live Writer
  10. ...
  11. Easily Add Multiple Content Columns
  12. ...
  13. WordPress Plugin Releases for 08/08
  14. ...
  15. WordPress Plugin Releases for 6/24
  16. ...
  17. WordPress Plugin Releases for 02/15
  18. ...
  19. WordPress Plugin Releases for 10/21
  20. ...
  21. ¿Habla HTML?
  22. ...
  23. 2 Plugin Security Bulletins
  24. ...
  25. Ultimate Guide to the WordPress Loop
  26. ...
  27. Adding Scripts Properly to WordPress Part 1 – wp_enqueue_script
  28. ...
  29. WordPress Plugin Releases for 08/20
  30. ...

  31. No Comments on "Passing Parameters as Variables vs Passing Parameters as An Array" »

    No comments yet.

    Leave a comment