Jump to content

oop error


Oleg

Recommended Posts

Hi all!

 

I am trying to stitch to OOP and to php5.

 

this is my code:

 

<?php

 

class MyClass

{

public $names = array("Oleg","Andrey","Tim","Shuks","John","Mark");

 

public static function MyName()

{

for($i = 0; $i <= 6; $i++)

{

print "My Public name is  - $i <br />";

}

}

private function MyOtherNames()

{

for($i = 0; $i <= 6; $i ++)

{

print "My Private name is $i <br />";

}

}

public static function OtherNames()

{

MyClass::MyName();

 

print_r $this->names;

}

}

 

MyClass::OtherNames();

?>

 

It gives me this error..

 

Why?

Link to comment
https://forums.phpfreaks.com/topic/47163-oop-error/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.