Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
1 answer
41 views

Why is my class not visible outside the file? [closed]

I have 2 PHP files as part of a website. The first one has the API functions (pre made ready to use requests), and the other one has the code itself that will call the functions from the first one. ...
Mohammad Ayaad's user avatar
2 votes
3 answers
2k views

PHP: how to access variables inside a function that have been declared outside of it?

At the very beginning of each page I include a file that starts the SESSION etc, lets call it session.php. In this file session.php, I include a file that contains a function, let's call it function1....
Chris's user avatar
  • 3,836
0 votes
3 answers
165 views

PHP include file that includes a file strange problem!

I face a strange problem including php files. Let me show you the code: // constants.php $MYSQL_HOST_PORT = 'localhost:3306'; // functions.php include 'constants.php'; function getVar() { echo $...
Vassilis's user avatar
  • 2,898
2 votes
4 answers
6k views

How can I see a variable defined in another php-file?

I use the same constant in all my php files. I do not want to assign the value of this variable in all my files. So, I wanted to create one "parameters.php" file and to do the assignment there. Then ...
Roman's user avatar
  • 129k