4 ms·
We typically handle that by having a $defaults array, then array_merge($defaults, $options) in the function.
by ceejayoz 12y ago
We typically handle that by having a $defaults array, then array_merge($defaults, $options) in the function.
- thefreeman 12y agoYep, totally valid, and like I said basically a preference thing. I personally like to work with explicit variables within the function rather then array indices. With your system I could easily call extract on your resulting array, but I also like defining the variables I want overridden explicitly in code so I my IDE doesn't think they are undefined (though JetBrains does a pretty good job of determining which variables are being created by extract in most scenarios anyway).