hi all
i've a function F as
function F($arg1,$arg2,$arg3){
....
}
and a variable $args = "A,B,C"
my goal is to call the function with the content of $args.
if i call f($args) i call this function with 1 argument : an array, i
wish call function as f(A,B,C)
If Someone thinks this is possible... please give me the code ;))
regards. 2 1242 jh****@gmail.com wrote:
hi all
i've a function F as
function F($arg1,$arg2,$arg3){
...
}
and a variable $args = "A,B,C"
my goal is to call the function with the content of $args.
if i call f($args) i call this function with 1 argument : an array, i
wish call function as f(A,B,C)
If Someone thinks this is possible... please give me the code ;))
regards.
f($args[0]. $args[1], $args[2]);
Or -
f($arg1, $arg2=null, $arg3=null) {
if (is_array($arg1) && $arg2==null && $arg3 == null) {
if (count($arg1) == 3)
$arg2 = $arg1[1];
$arg3 = $arg1[2];
$arg1 = $arg1[0];
}
else {
echo "Insufficient number of parameters passed<br>\n";
exit();
}
}
... rest of stuff here
}
Of course you should do other checking to ensure you're passing 3
arguments in the array.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attglobal.net
================== jh****@gmail.com wrote:
hi all
i've a function F as
function F($arg1,$arg2,$arg3){
...
}
and a variable $args = "A,B,C"
my goal is to call the function with the content of $args.
if i call f($args) i call this function with 1 argument : an array, i
wish call function as f(A,B,C)
If Someone thinks this is possible... please give me the code ;))
regards.
call_user_func_array('F', explode(',' $args)); This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chuck Anderson |
last post by:
I have a function with 7 inputs. The last three have default values.
I want to call that function specifying the first four, skip two and
then specify the last.
I thought I could write this...
|
by: Matt Eberts |
last post by:
Sorry, bad title. Anyway, is there a way to pass the arguments to an object
instantiated via a constructor using the arguments object and have it
expanded, so to speak, so that it doesn't appear as...
|
by: William Payne |
last post by:
Hello, consider the following two classes (parent and child):
#ifndef SINGLETON_HPP
#define SINGLETON_HPP
#include <cstddef> /* NULL */
template <typename T>
class Singleton
{
|
by: Melkor Ainur |
last post by:
Hello,
I'm attempting to build an interpreter for a pascal-like language.
Currently, I don't generate any assembly. Instead, I just build an
abstract syntax tree representing what I've parsed...
|
by: dragoncoder |
last post by:
Consider the following code.
#include <stdio.h>
int main()
{
int i =1;
printf("%d ,%d ,%d\n",i,++i,i++);
return 0;
}
| |
by: Telmo Costa |
last post by:
Hi. I have the following code:
--------------------------------------
function Tunnel() {
//arguments(???);
}
function Sum() {
var sum = 0;
for (i=0; i<arguments.length; i++) sum +=...
|
by: Csaba Gabor |
last post by:
Inside a function, I'd like to know the call stack. By this I mean
that I'd like to know the function that called this one, that one's
caller and so on.
So I thought to do:
<script...
|
by: sfeher |
last post by:
Hi All,
Is there a way to preserve the arguments across functions?
I have:
<script>
function myFirstFunction()
{
// arguments = 'param1'
|
by: ADezii |
last post by:
When a call is made to a Sub or Function Procedure, you can supply Arguments in the exact order they appear in the Procedure's definition, or you can supply them in any position by name. To...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |