When a function is defined in the php class member method, the following error occurs during recursive call ????!!!

Source: Internet
Author: User
Can custom functions be written in php member methods? I have defined a function in a method, but an error is reported during the call. this is the method that reports the following error. However, I have another method that also writes the function and performs recursion, but no error is reported. Which of the following methods can be used to call custom functions in the Member methods of... php?
I have defined a function in a method, but an error is reported during the call.
This is the method for reporting the error.

Solution:

1. check the error message. your code has a getTree method and cannot be redefined. Rename or define your getTree to different namespaces.

II.

Remove the function that reports the error first. Write a piece of code to check whether the getTree () function already exists:

If (function_exists ('gettree') {echo 'The getTree () function already exists'} else {echo 'The getTree () function does not exist '}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.