IntactDev
Member
- Nov 22, 2012
- 399
- 71
Hello DevBest.
I'm here today with a topic that has recently come to my attention. I was once trying to do a revamp of my current framework (by adding a secure backend panel). I ran into a loop of death because of this issue.
Say I have a class called "cat" and a class called "dog".
With more advanced applications, it becomes one big loop when using the global function... What the the other way of calling a function inside another function?
@Kryptos @RastaLulz @Sledmore @Macemore @WhoeverElseThatsGoodAtPHP
I'm here today with a topic that has recently come to my attention. I was once trying to do a revamp of my current framework (by adding a secure backend panel). I ran into a loop of death because of this issue.
Say I have a class called "cat" and a class called "dog".
PHP:
<?php
class cat {
function meow() {
return 'what does the cat say?';
}
}
class dog {
function bark() {
return 'what does the dog say?';
}
}
new cat = $cat();
new dog = $dog();
class animals {
function sounds() {
global cat, dog; #--o here's where the issue starts! o--#
echo $cat->meow() . '<br>' . $dog->bark();
}
}
?>
With more advanced applications, it becomes one big loop when using the global function... What the the other way of calling a function inside another function?
@Kryptos @RastaLulz @Sledmore @Macemore @WhoeverElseThatsGoodAtPHP