|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-02-11 11:53 UTC] dellytufy at hotmail dot com
Description:
------------
i cannot use namespace in eval()
as
eval('use namespaceName\classname as myClass;');
after this i cannot ust $mc=myClass(); undeclared class
namespace d3;
namespace d3\sql;
class oracle{
public $type='oracle';
}
namespace d3\linq;
class linq{
public $className='linq';
}
$type='oracle';
eval('use \d3\sql\\'.$type.' as baglanti;');
$a=new baglanti();// error. undeclared class d3\linq\baglanti
echo $a->type;
Reproduce code:
---------------
$type='oracle';
eval('use \d3\sql\\'.$type.' as baglanti; $a=new baglanti();');
echo $a->type;
but this is successfully runned.
Expected result:
----------------
namespace d3;
namespace d3\sql;
class oracle{
public $type='oracle';
}
namespace d3\linq;
class linq{
public $className='linq';
}
$type='oracle';
eval('use \d3\sql\\'.$type.' as baglanti;');
$a=new baglanti();
echo $a->type;
i think it must write oracle .
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 12:00:02 2025 UTC |
thanx i will check again but why it's running eval('use \d3\sql\\'.$type.' as baglanti; $a=new baglanti();'); it's not eval('use \d3\sql\\'.$type.' as baglanti;');