When Class method same name php function

897

Consider this code:

class some_class extends someother_class
{

function delete()
{
    delete($somefile); // <-- That refers to the PHP function called delete

    parent::delete();  // <-- That refers to the delete() method in the parent class
}

}

How do I use the PHP function delete from within the delete method in the extended class?

959

Answer

Solution:

You should be able to usecall_user_func_array() here:

class some_class extends someother_class
{

    function delete()
    {
        call_user_func_array('delete', array($somefile)); 

        parent::delete();  
    }

}

People are also looking for solutions to the problem: $_SERVER['HTTP_REFERER'] The page isn't redirecting properly PHP

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.