PHP - function that both returns and echoes a value -
i create function both returns , echoes value. not 2 together. or return or echo. , looking beautiful way it. functions / class methods in project must have option.
i can pass function bool value indicates whether echo or return value seems not beautiful me.
how, think, better implement this? maybe built-in option in php?
passing boolean value way go, print_r same:
mixed print_r ( mixed $expression [, bool $return = false ] )
if capture output of print_r(), use return parameter. when parameter set true, print_r() return information rather print it.
Comments
Post a Comment