I am looking for documentation that describes PHP OOP method names. See the code and description for an interesting example.
The code in the snippet below is posted on my server at http://www.laprbass.com/RAY_temp_adamssap.php
Fatal error: Cannot redeclare StripSlashes() in /home/websitet/public_html
hp on line 25
If you remove the code from line 20 to the end, the script runs correctly.
The apparent behavior shows that it is a fatal error to redeclare a function name outside of the class. However the method name inside the class is somehow distinct from PHP function names. This makes sense in that two different classes may have the same method names. However it seems slightly counterintuitive to me and might make for awkward programming if one reused the built-in PHP function names to name methods. It also seems as if there should be documentation about "function scope" like there is about "variable scope."
I understand variable scope.
Can anyone please point me to the man page that describes "function scope?"
<?php // RAY_temp_adamssap.php
// A CLASS DEFINITION WITH A METHOD NAME THAT DUPLICATES A PHP FUNCTION
$str = stripslashes($str);
$x = new Thing;
$y = $x->stripSlashes('abcdefg');
// TRY TO DEFINE THE FUNCTION OUTSIDE OF THE CLASS CONTEXT