PHP Two functions with same name -


how include 2 functions same name in php file?

i have 2 files:

file1.php includes

function getresidentcount() {}

function getresidentdata() {}

file2.php includes

function getresidentcount() {}

function getresidentdata() {}

i need file3.php include of these functions since each 1 used calculate different resident counts , data.

any idea how can include both of these files in 1 file. cannot change original files (they in production live app).

thanks, claudia

this evil. offer exercise.

include('file1.php'); //include('file2.php');  $php=file_get_contents("file2.php"); $php=str_replace('getresidentcount', 'file2getresidentcount', $php); $php=str_replace('getresidentdata', 'file2getresidentdata', $php); eval($php); 

now can call duplicated function different name!

do not this. it's idea :)

an alternative use apd extension, lets rename functions. include first file, rename functions rename_function, include second file.

really, should take deep breath, delay you're doing, , refactor have. learn , change practices can't happen again. namespaces might you, more object oriented approach might also.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -