Monday, April 3, 2017

Creating PHP function with respect to syntax

I didn't know how to put the question.

I know I can create a function like

function abc($type, $value)
{
    //TO DO 
}

and use it like

abc('name','superman');

But I want to have a function that would result in syntax like

$name->validate('length', 10);

Now how do I achieve this kind of syntax and create a function validate that would support this syntax. Also I work in Laravel if anyone can help would be appreciated.



via Alen

Advertisement