0
This is my problem : for the sake of debug
I decided to create a function that would return me a print_r
formatted without the need for a gambiarra (that is, without creating the <pre>/<pre>
. That way, I’d turn it:
<?php
echo "<pre>";
print_r($array);
echo "</pre>";
?>
In that:
<?php printr($array); //onde a função *printr* foi criada por mim. ?>
But... For me that wasn’t enough, I wanted to have two methods printr
: one that received only one parameter and actually printed on the screen; another that received two parameters, where one wrote a message as System Debug , and another to print the print_r
as I wished.
Behold, I ask myself, how do I do this, knowing that the PHP does not allow me to create two methods with the same name?
It may be what you wanted, but this has nothing to do with overloading.
– Maniero
So I think my concepts are wrong, could you create an example using this concept?
– Walter Felipe
I’m new in the field, and this is the only way I’ve found to solve this problem
– Walter Felipe
PHP must not overload.
– Maniero
Exactly! That was the only efficient way I found of dribble this problem.
– Walter Felipe
Go back to my first comment, we’re in loop.
– Maniero