PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
<?php
class newclass {
public function newfunc() {
echo 'class exist';
}
}
if (true) {
class myclass1 extends newclass {}
}
else {
class myclass2 extends newclass {}
}
$test = new myclass2;
$test->newfunc();
in browser i get
class exist
, but in cli i get
Fatal error: Class 'myclass2' not found in test.php on line 15
--------------------run with php vs php-cgi--------------------
[root@server]# php test.php
Fatal error: Class 'myclass2' not found in test.php on line 15
[root@server]# php-cgi test.php
X-Powered-By: PHP/5.2.6
Content-type: text/html
class exist
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.