No, there's nothing like private or public functions/methods. There's no way
preventing someone using your private functions/methods.

"Eric Starr" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
000e01c1e041$d931cc20$[EMAIL PROTECTED]">news:000e01c1e041$d931cc20$[EMAIL PROTECTED]...
I am a Java programmer learning PHP.

In Java you can have a class that contains public and private functions.
Only the public functions are accessible outside of the class.  Does PHP
have a way to hide functions within a class (i.e. make the private)?

My concern is that there are some functions that you don't want anyone being
able to call...only local functions within the same class should be able to
call it.

I'll give an example below:

<?php  // myClass.php3
   class myClass
   {
       function f1 // I want this one to be public
       {
           f2();
       }
       function f2  // I want this one to be private
       {}
   }
?>

<?php include 'myClass.php3';
      $p = new myClass();
      $p->f1(); // I want this to be a valid function call
      $p->f2(); // I want this to be an invalid function call
?>


Any help would be greatly appreciated.

Eric Starr








-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to