Re: problem calling functions

From: Date: Sat, 20 Oct 2007 12:29:19 +0000
Subject: Re: problem calling functions
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-263438@lists.php.net to get a copy of this message
On 19/10/2007, afan pasalic <afan@afan.net> wrote: > > > Robin Vickery wrote: > > On 19/10/2007, afan pasalic <afan@afan.net> wrote: > > > >> hi > >> I have a problem with calling functions: > >> > >> <?php > >> function solution1($var1) { > >> // some code > >> } > >> > >> function solution2($var2) { > >> // some code > >> } > >> > >> function solution3($var3) { > >> // some code > >> } > >> > >> if ($function == 'solution1' or $function == 'solution2' or > >> $function == > >> 'solution3') > >> { > >> $my_solution = $function($var); # this supposed to call one of > >> "solution" functions, right? > >> } > >> ?> > >> > >> suggestions? > >> > > > > suggestions for what? > > > > What is your problem? If you set $function to 'solution1' and run your > > code, it will indeed execute solution1(). > > > > -robin > > > > the problem is that this code doesn't work. and I was asking where is > the problem, or can I do it this way at all. Firstly, the code you posted does indeed work fine. Secondly, you need to learn to ask questions properly: What do you expect the code to do? What is it actually doing? Are there any error messages, if so what are they? -robin

« previous php.general (#263438) next »