Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespaces in php 5.2

I've done little web using namespaces. I have it in my computer and i'm about to moving it to free hosting that uses php 5.2. Syntax highlighter for php 5.2 interprets them as errors.

Are namespaces supported by php 5.2?

If not is there any way how to use them with little changes to existing code?

like image 320
kravemir Avatar asked Jun 24 '11 19:06

kravemir


People also ask

What are the namespaces in PHP?

Namespaces are qualifiers that solve two different problems: They allow for better organization by grouping classes that work together to perform a task. They allow the same name to be used for more than one class.

Does PHP have namespace?

In the PHP world, namespaces are designed to solve two problems that authors of libraries and applications encounter when creating re-usable code elements such as classes or functions: Name collisions between code you create, and internal PHP classes/functions/constants or third-party classes/functions/constants.

Can I use two namespace in PHP?

Multiple namespaces may also be declared in the same file. There are two allowed syntaxes. This syntax is not recommended for combining namespaces into a single file. Instead it is recommended to use the alternate bracketed syntax.

What is namespace example?

In an operating system, an example of namespace is a directory. Each name in a directory uniquely identifies one file or subdirectory. As a rule, names in a namespace cannot have more than one meaning; that is, different meanings cannot share the same name in the same namespace.


1 Answers

Namespaces are not supported prior to 5.3. There isn't really a way to adapt for them into 5.2 unfortunately.

like image 147
Michael Berkowski Avatar answered Oct 30 '22 09:10

Michael Berkowski