[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]
4chanarchives logo

I've been leaning PHP.I made a program, it runs straight down to the end using


Thread replies: 10
Thread images: 2

File: elephpant.png (19KB, 281x193px) Image search: [Google] [Yandex] [Bing]
elephpant.png
19KB, 281x193px
I've been leaning PHP.

I made a program, it runs straight down to the end using loops and locks but I recently discovered goto.

Does this mean I can have it jump around and skip sections of code if needed?

Is this a good or bad idea?
>>
Goto is only useful in very specific circumstances.
Fucking wevdevs.
>>
using goto is a bad idea, because you might suddenly switch scopes and fuck your shit up
>>
>>53673748
goto is terrible, shouldn't the concept of object orientation destroy the need for using goto..
>>
That is what functions are for
>>
dumb php devs
>>
File: Brendan_Fraser.jpg (72KB, 563x600px) Image search: [Google] [Yandex] [Bing]
Brendan_Fraser.jpg
72KB, 563x600px
Using goto, how would you help Brendan escape alimony?

$bank = 25,000,000;
$brendan = 'divorced';

function pay_alimony() {
$bank = $bank - 900,000;
$just = "fuck my shit up";
}

if ($brendan != 'married') {
pay_alimony();
echo $just;
} else {
$just = "give me a clean cut";
}
>>
>>53673896
I would teach Brendan that $just needs to be defined outside of the pay_alimony scope or else its gonna break. Fucking hell brendan...
>>
>>53673896
$bank = 100000000;
$brendan = 'single';

goto the_mummy;

$bank = 25000000;
$brendan = 'divorced';
$just = "fuck my shit up";

function pay_alimony() {
global $bank;
$bank = $bank - 900000;
}

the_mummy:

if ($brendan != 'married' && $brendan != 'single') {
pay_alimony();
echo $just;
} else {
$just = "give me a clean cut";
echo $just;
}
>>
>>53673748
The usage of goto was deprecated decades ago. Use proper flow control.
Thread replies: 10
Thread images: 2
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y / ] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
If a post contains illegal content, please click on its [Report] button and follow the instructions.
This is a 4chan archive - all of the content originated from them. If you need information for a Poster - you need to contact them.
This website shows only archived content and is not affiliated with 4chan in any way.
If you like this website please support us by donating with Bitcoin at 1XVgDnu36zCj97gLdeSwHMdiJaBkqhtMK