PHP, how to pass func-get-args values to another function as list of arguments? -


मैं एक समारोह बनाना चाहता हूँ ( my_function () ) असीमित संख्या में बहस प्राप्त करना और इसे पारित करना दूसरे फ़ंक्शन में ( call_another_function () )।

  फ़ंक्शन my_function () {another_function ($ arg1, $ arg2, $ arg3 ... $ argn); }  

तो, कॉल करने के लिए my_function (1,2,3,4,5) और कॉल करना चाहते हैं another_function (1,2,3, 4,5)

मुझे पता है कि मैं shoud का उपयोग func_get_args () सरणी के रूप में सभी फ़ंक्शन तर्कों को प्राप्त करने के लिए करता हूं, लेकिन मुझे यह पता नहीं है कि यह तर्क कैसे पास करें

प्रयास करें:

< पूर्व> फ़ंक्शन my_function () {$ args = func_get_args (); Call_user_func_array ("another_function", $ आर्ग्स); }

प्रोग्रामिंग और कंप्यूटर विज्ञान में, इसे एक फ़ंक्शन कहा जाता है।


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -