PHP funtion's alias

While writing code I always use the PHP function 'var_dump()'. And I'm fed of typing var_dump($variable) every time I need it. So I made a small and simple function - v($variable):

function v($variable)
{
    var_dump($variable);
}
Usually it can be placed at the beginning of a PHP file.
If you use Object model, i.e. you write classes, this function should be placed before Class definition:

function v($variable)
{
    var_dump($variable);
}
class SomeClass
{
    ...
Function v() will be accessible in your class methods just like v($var).

And don't forget to remove it while moving to production.

No comments:

Post a Comment