Do I want to assign a function to the array of an array ??? Like - [â "client_name] ???? ??? A first level value works because I can
$ index = client_name; function arraying ($ index) {return $ This-> array-driver [$ index];} What is the question? How can I do this, if it is a multi-nested array? < P> I tried the eval statement and apparently the brackets are not evaluated? Then I tried to do it.
$ index = one ???? [ 0] [A customer ???] A ????; Eval (a ???? $ this-> arraytolookat $ indexâ ????); But this Just fails ?? An unexpected [- any thoughts?
About the Edit Wings: I do not know how much level can be required to go to this function, so I end up Can not add only one set bracket in it is not as simple as that ^^
Edit 2: Basically - I have written a form validation tool and in the function Gives a correct post data - I wanted a simple method when you form element - it will literally return the element back to the element such as getFormData ("client_name") - but when a form becomes more complex, So this can go into arrays, I getFormData ("['$ I'] client_name") or some items with those lines, the content of the postcard in that class, so that the function can be used. I just do not want to take that function in a string, which is not an array.
You can give this function an array of indexed below. So if you want to get the $ some_array [0] ['client_name'] ['third_love_index'] , then you can: function get_array_value ( Array $ array, array $ index) {if (count ($ array) == 0 || count ($ index) == 0) {return false; } $ Index = array_shift ($ index); If (! Array_key_exists ($ index, $ array)) {return false; } $ Value = $ array [$ index]; If (count ($ index) == 0) {return value $; } If (! Is_are ($ value)) {return false; } Return get_array_value ($ value, $ index); } $ Some_array = array (/ * nested arrays / /); $ Index = array (0, 'client_name', 'third_level_indack'); $ Value = get_array_value ($ some_array, $ index);
Comments
Post a Comment