I’m fairly new to the php development thing. But I’m learning fast. Of course I’m having to deal with newbie problems along the way. Today I was adding a class to my DAL. Nothing special, mainly copy paste stuff. But php wasn’t being very cooperative, it kept showing me an empty page whenever I added (require_once(“filepath”)) that file to my factory. Not very amusing. So after a little searching I found out that php doesn’t support classes with the same name. But how am I supposed to know that the same name already exists somewhere? In short you can’t.
But there are solutions to the problem.
First: if you have php version 5.3 or higher you can use namespaces which is nicely explained by David.
Second: if you have a version less then 5.3 you can use a poormans version, and should, of namespaces. Meaning, you have to add things to your classname and seperate them with an underscore. Something like
php
class LTD_User{}