Here is a situation.
I want to duplicate an API twice on my server but with different databases. What I want to do is to use some function of these API’s. In PHP I have a situation where I am implmenting a loop of all these API locations.
forach($apis as $api){
include ($api->apiFiles);
useAPIfunction();
}
the problem is The API have the same functions and classes, the loop runs one time but for the second time the PHP Fatal error cannot redeclare function” occurs.
Now I don’t want to change the API like changing function names etc, I have to do all from my script. Is there a situation to unregister the API file after the first iteration completed because it is the only way to include the new API.
Thanks in Advance for Help.
I have done a trick. I included the API files on the first iteration and then for other iteration add a script to connected to the second database and vice verse. Now the API will be connected once using the first API files but the Database is changing on new iteration. Also I did not found a way to get The Database Info so I retrieved it from the API config file.
}