[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    Re: [PHP] Redefine Funtion
From:       Jeffry Killen <jekillen () prodigy ! net>
Date:       2015-12-01 6:54:54
Message-ID: 2C544E44-31E0-490C-AA29-24F1C86B5C5A () prodigy ! net
[Download RAW message or body]


On Nov 30, 2015, at 10:11 PM, Szopen Xiao wrote:

> php un-support redefine function, you can use anonymous function  
> implement
> redefine
>
> 2015-12-01 9:52 GMT+08:00 Ethan Rosenberg <erosenberg@hygeiabiomedical.com 
> >:
>
>> Dear List -
>>
>> Thanks for all your help with my previous question.
>>
>> This works -
>>
>>      $output = shell_exec('php P7a.php');
>>      echo $output;
>>
>> Now another question -
>>
>>    function SetParameters()
>>    {
>>     etc......
>>    }
>>
>>        switch ($_POST['next_step'])
>>        {
>>
>>                case 'step1':
>>                {
>>
>>                        SetParameters();
>>                        Choice();
>>                        break;
>>
>>                }
>>        } //end switch
>> // yes, there are more cases, and I have checked for mismatched
>> parenthesis and have not found //any.
>>
>> Fatal error: Cannot redeclare SetParameters() (previously declared in
>> /var/www/P7a.php:109) in /var/www/P7a.php on line 180
>>
>> ???
>>

I would look at the code in P7a.php, line 109. This error is pretty  
explicit:
You probably have a function named SetParameters() defined  in it.
I presume that because you are calling it in shell_exec, it is a CLI  
script(?)
I would do, in your $_POST processing script:

include('P7a.php');
// then run the function code defined in it, rather than have code run  
automatically
//it is included.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic