fivestringsurf Posted February 19, 2011 Share Posted February 19, 2011 I just wanted to get some feedback on this topic. Ive written many php functions/classes in the past and some of the more complicated ones end up with many arguments...like ... function my_fun($arg1, $arg2, $arg3, $arg4){ ... Lately I've had my head into many jQuery and ActionScript3 developments. I love writing classes with those languages/frameworks (especially in as3) in which I simpy pass one argument (an object literal) which contains all the data necessary. It seems like such a clean way to write modular classes and makes the class very "readable" later on. I'm sure I can accomplish something similar to this using an associative array in php...but I just wanted to hear some of you guy's (and girl's) thoughts on this. let's hear it! Link to comment https://forums.phpfreaks.com/topic/228203-objectsfunctions-arguments-like-jquery-or-as3/ Share on other sites More sharing options...
BlueSkyIS Posted February 19, 2011 Share Posted February 19, 2011 pass an array containing all values. Link to comment https://forums.phpfreaks.com/topic/228203-objectsfunctions-arguments-like-jquery-or-as3/#findComment-1176793 Share on other sites More sharing options...
fivestringsurf Posted February 19, 2011 Author Share Posted February 19, 2011 thanks for the response yep that's what I've been playing around with...plus I think many php folks use separate methods for each setting...I guess you would call it a "setter"? where as that design pattern hasn't looked quite the same, especially in jQuery plugins to be specific. Link to comment https://forums.phpfreaks.com/topic/228203-objectsfunctions-arguments-like-jquery-or-as3/#findComment-1176798 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.