eleven0 Posted January 16, 2008 Share Posted January 16, 2008 I declared a function in my index.php and I want to use that function in another page. How do I do this? Link to comment https://forums.phpfreaks.com/topic/86302-solved-qq-how-to-use-functions-that-are-declared-in-other-pages/ Share on other sites More sharing options...
adam291086 Posted January 16, 2008 Share Posted January 16, 2008 you need to include that page i.e include(../functions.php) Link to comment https://forums.phpfreaks.com/topic/86302-solved-qq-how-to-use-functions-that-are-declared-in-other-pages/#findComment-440887 Share on other sites More sharing options...
nikefido Posted January 16, 2008 Share Posted January 16, 2008 you should take that function OUT of your index.php, create a new file (functions.php for example) and then include that functions.php file in any .php file in which you wish to use that function. Hope that make sense! Link to comment https://forums.phpfreaks.com/topic/86302-solved-qq-how-to-use-functions-that-are-declared-in-other-pages/#findComment-440890 Share on other sites More sharing options...
eleven0 Posted January 16, 2008 Author Share Posted January 16, 2008 yea it makes sense... I used include but other stuff in index.php showed up. I thought there was a way of getting just that function i declared. Thanks. Link to comment https://forums.phpfreaks.com/topic/86302-solved-qq-how-to-use-functions-that-are-declared-in-other-pages/#findComment-440897 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.