I'm trying to instantiate a class that use namespace.
<?php namespace CFPropertyList; require_once('CFPropertyList/CFPropertyList.php'); $plist = new CFPropertyList(); ?> That's working!
But when I try put that code into my class I get syntax errors. I can't use "namespace CFPropertyList;" in a class?
<?php class Plist{ public function test(){ namespace CFPropertyList; require_once('CFPropertyList/CFPropertyList.php'); $plist = new CFPropertyList(); } } ?> UPDATE:
Thanks to all I got this working.
<?php namespace CFPropertyList; require_once('CFPropertyList/CFPropertyList.php'); class Plist{ public function test(){ //some code } } } But is my own class in a namespace now? Sorry for the noob questions. I can't do.
$plist = new Plist; $plist->test();