[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
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 10
Thread images: 2
File: elephpant.png (19 KB, 281x193) Image search: [Google]
elephpant.png
19 KB, 281x193
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 (72 KB, 563x600) Image search: [Google]
Brendan_Fraser.jpg
72 KB, 563x600
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

banner
banner
[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.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.