f



no error, no warning

Is will warning or error must be in this code? In my system no error.

<?php
class Insurance
{
function clsName()
{
echo get_class($this);
}
}
Insurance::clsName();
?>



0
koptyaev (37)
11/9/2008 3:11:10 PM
comp.lang.php 32646 articles. 0 followers. Post Follow

2 Replies
1293 Views

Similar Articles

[PageSpeed] 51

Andrew G. Koptyaev wrote:
> Is will warning or error must be in this code? In my system no error.
> 
> <?php
> class Insurance
> {
> function clsName()
> {
> echo get_class($this);
> }
> }
> Insurance::clsName();
> ?>
> 
> 
> 

You need to instantiate an object of your class.

$obj_Foo = new Insurance;
$obj_Foo->clsName();

You might be trying to run before you can walk.
0
arestes (103)
11/9/2008 8:15:19 PM
Andrew G. Koptyaev escribi�:
> Is will warning or error must be in this code? In my system no error.

Enable full error reporting. Find your php.ini file and edit these 
directives:

error_reporting = E_ALL | E_STRICT
display_errors = On

Then you'll see that your code raises a notice.


> <?php
> class Insurance
> {
> function clsName()
> {
> echo get_class($this);
> }
> }
> Insurance::clsName();
> ?>




-- 
-- http://alvaro.es - �lvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programaci�n web: http://bits.demogracia.com
-- Mi web de humor al ba�o Mar�a: http://www.demogracia.com
--
0
11/10/2008 8:41:27 AM
Reply: