I am new to PHP, coming from the .Net world. My project is a Report Server. each report is treated like a php file that goes to the database, gets json data, and prints it on screen for the user to see.
I am trying to get a list of php files in a folder, dimensionalize them, and get certain properties declared inside that file.
For example, i would have a file called: "sales_report.php" Within that i would have:
class sales_report.php {
Public $tags = array('sales','invoice','margin')
// code to fetch data from database, get json, and print report into html.
}
I need to be able to see the $tags, but i won't know this file/class exists until i have a previous code that dimensionalizes this class.
question: does anybody know how to dimensionalize a php file
Look at glob()
to do what you're asking: http://us1.php.net/glob
Look at _autoload()
for another way to do what you want: http://php.net/manual/en/language.oop5.autoload.php
'Dimensionalize' is not a word in PHP. If you require or include the file, the code within it is run. You may mean you want to 'instantiate' an object based on a class in your file.
require_once('sales_report.php');
$object = new sales_report();
echo $object->tags[0]; // prints 'sales'