Public Function

Question

I get an error on my class

[31-Dec-2016 20:05:53 Africa/Casablanca] PHP Parse error: syntax error, unexpected 'Private' (T_PRIVATE), expecting identifier (T_STRING) in /home/address/main.php on line 5

Haven't added anything to the class yet

    <?php

  class Modeladdonmain extends Hand {

      public function Private() {

      }

      public function Poke() {

      }

      public function Whisper() {

      }

  }
 ?>

Show source
| function   | class   | php   | string   2016-12-31 21:12 1 Answers

Answers ( 1 )

  1. 2016-12-31 21:12

    Your function Private() contains special word private which is used for declaring members, etc.

    Any other similar name would solve your issue. For example, instead of Private() you can use something like privateFunction() (if you're ok with that name).

    Similarly, you can't use names like Protected() or Public().

◀ Go back