Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WTF PHP

Name: php is fucking shit 2012-02-21 8:26

Example #1 Using global

<?php
$a = 1;
$b = 2;

function Sum()
{
    global $a, $b;

    $b = $a + $b;
}

Sum();
echo $b;
?>


 The above script will output 3. By declaring $a and $b global within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function.

Name: python is fucking shit 2012-02-21 8:31


a = 1
b = 2

def Sum():
    global a, b
    b = a + b

Sum()
print b



The above script will output 3. By declaring a and b global within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function.

Name: Anonymous 2012-02-21 8:33

Looks like it's time to learn D.

Name: Anonymous 2012-02-21 8:39

>>3
FUCK YOU FAGGOT I FUCKING HATE YOU!

Name: Anonymous 2012-02-21 9:20


int a = 1;
int b = 2;

void Sum()
{
    b = a + b;
}

int main()
{
    Sum();
    cout << b;
}


The above script will output 3. By using a and b within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function.

Name: Anonymous 2012-02-21 9:25


var a = 1
var b = 2

Sum()
{
    b = a + b
}

main()
{
    Sum();
    printf("%d\n", b);
}

Name: Anonymous 2012-02-21 9:28

|var a = 1
|var b = 2
|main()
|printf("%d\n", b);

What the fuck language is this?

Name: Anonymous 2012-02-21 9:29

>>4
D allows you to write extremely fast and responsive forum software, see for yourself how nice does it feel: http://forum.dlang.org/

Besides attracting more users (according to Google, the difference between 0.9s and 0.4s page load time results in 20% difference in traffic [1]), using D instead of PHP will literally save you money in hardware and maintenance costs, especially if you are using solutions like Amazon AWS.

Plus, D has a powerful type system which allows for much faster development: a bug caught at compile time costs 10x less to fix than one caught by unittests, 100x less than one caught immediately after deployment, and 1000x less than one caught during normal operation. Statically-enforced protection from all kinds of injections is simply priceless.

References:
[1]: http://glinden.blogspot.com/2006/11/marissa-mayer-at-web-20.html

Name: Anonymous 2012-02-21 9:45

What the fuck did you expect "global" to do? Handle them locally?

Name: Anonymous 2012-02-21 9:55

>>9


$a = 1

function shit {
   echo $a;
}


This crappy of a language will print NOTHING when i call the shit function. I need to use the global keyword if i want the shit function to print 1

WTF PHP!

Name: Anonymous 2012-02-21 9:55

>>9
What the fuck do you expect "tear_my_anus_with_spoon" to do? Tear it with a fork?

Name: Anonymous 2012-02-21 9:58

>>10
s/crappy/crappy attempt/

Name: Anonymous 2012-02-21 11:32

>>8
Marissa
What a shitty misspelling.

Name: Anonymous 2012-02-21 12:05

>>8
That forum... Sure it's fast

Name: Anonymous 2012-02-21 15:02


(define a 1)
(define b 2)

(define (sum)
    (set! a (+ a b)))

(sum)
(display a)


The above script will output 3. By using a and b within the function, all references to either variable will refer to the global version. There is no limit to the number of global variables that can be manipulated by a function.

Name: Anonymous 2012-02-21 15:12

>>1
This isn't really all that WTF-worthy, given the weird scope shit in other popular scripting languages like Ruby and Python. Here's a better one:

>>> 0x0 +2
4
>>> 0x0 +3.5
6.5
>>> 0x0 +2e1
757


They have a whole bunch of these on that other terrible website. http://redd.it/ps6x5

Name: Anonymous 2012-02-21 15:42

>>16
The funny part is that strtol accepts a leading 0x in hexadecimal numeric strings if you use base 16, so they didn't have to do that hack anyway.

Name: Anonymous 2012-02-21 16:08

>>14
It is! Seriously!

Name: Anonymous 2012-02-21 16:13

>implicit local declarations
>2012

Name: Anonymous 2012-02-21 16:32

>>19
It's ok I guess. I dislike the lua approach to put local everywhere.

Name: Anonymous 2012-02-21 16:42

>>3
Fuck off. Nobody cares about your shitty toy language.

Name: Anonymous 2012-02-22 23:15

>>21
o oh oh, but I do! I do!

Name: [spoiler]test[/spoiler] 2012-02-23 9:28

The game

Name: Anonymous 2012-02-24 10:02

just noting that its funny how the unicode reverse thing changed the topic from "WTF PHP" to "PHP FTW"

Name: Anonymous 2012-02-24 10:07

>>24
In the bizzare world, is PHP FTW
http://en.wikipedia.org/wiki/Bizarro_World

Name: Anonymous 2012-03-12 14:46

I like to have to use global in PHP.

Is like forcing you to acknowledge that you are a clumsy designer for relying on globals.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List