PHP Code ?

I have this line of code in one of my php files, I receive an error the directory on line 108 can't be found.  I'm new to PHP, and not sure which directory this represents:

require $this->classes[$class];
Jack_son_Asked:
Who is Participating?
 
Ray PaseurConnect With a Mentor Commented:
I receive an error
Please show us the EXACT text of the error message.  If you have this code on a public server, please post the URL that can be used to see the error message.

If you're new to PHP but have an extensive programming background in other languages, you may be able to get up to speed on the OOP parts of PHP by reading here:
http://us.php.net/manual/en/language.oop5.php

If you do not have a deep background in other programming languages and you're starting programming by learning PHP, jumping into object-oriented programming might be the "deep end" of the pool.  You might want to start by learning the conventional notation and syntax used to write program code in PHP.  For that, this book is great place to start.  Give yourself a month or two to work through the examples, and you'll be ready for the object-oriented programming at any level of immersion!
http://www.sitepoint.com/books/phpmysql5/

Best of luck with your project, ~Ray
0
 
OmniUnlimitedConnect With a Mentor Commented:
Just echo it to see the directory and file that the error is occurring on:

echo $this->classes[$class]; 
exit;

require $this->classes[$class];

Open in new window

0
 
Marco GasiConnect With a Mentor FreelancerCommented:
$this is a key word used in OOP code: it refers to the actual object itself and in your case this means that classes[$class] should be a value set in the initialization code or in a config file. Since you say you're new to php, I think you grabbed that code somewhere and you're trying to use it in a wrong way. Could be more descriptive and tell us what exactly is that code?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
Julian HansenConnect With a Mentor Commented:
Can you post the exact error message and also some more code to give a context.
0
 
Jack_son_Author Commented:
i have a test php app, trying to put back together.  It shows no such file or directory on line 108, the above was line 108, so trying to figure out the location of that directory.
0
 
Marco GasiConnect With a Mentor FreelancerCommented:
As said in comment ID: 38362451, $this->classes[$class] is a class property wich evidently should hold a directory.

 Try to echoing the property as suggested by comment ID: 38362279

echo $this->classes[$class];
exit;

require $this->classes[$class];

You can also try to look for a config.php through the application directory (it could be a folder called 'config' or 'setup').
As I said before, that property could (or should) be initialized when you create the object: in this case, you should look for the file where that object is created (maybe index.php if you just tried to run the app and you got this error) and look for the line where the object is created.

If you tell me how the object is called, I can be more precise suggesting what code you should look for.

Cheers
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.