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

Pages: 1-

holy shit php sucks and is written by idiots

Name: Anonymous 2012-12-20 18:46

https://bugs.php.net/bug.php?id=54547

Please have a look at the comments by abakobob and myself ("nikic@php.net"). They explain why such behavior is actually good, in most cases.

Name: Anonymous 2012-12-20 18:47

This isn't just a bug, it's a summary of PHP as a language: broken by design.

HAHAHAHAHAHA

Name: Anonymous 2012-12-20 19:00

It's a loosely typed language. Use === if you want a STRICT comparison.

Duh.

Name: Anonymous 2012-12-20 19:40

I call it drunk typing.

Name: Anonymous 2012-12-20 21:43

>>4
fuckkk you faggot you made me laughh

Name: Anonymous 2012-12-21 0:54

the incompetence of these people is amazing.

Name: Anonymous 2012-12-21 14:13

Maybe this should be Won't Fix to keep it consistent with
>
9223372036854775807 == 9223372036854775808 (with
number literals).

Yes that is [b]CONSISTENT[b]

Name: Anonymous 2012-12-21 14:15

>>7
Fail BBCode is fail.

Name: Anonymous 2012-12-21 14:16

>>8

It is almost like <?php

Name: Anonymous 2012-12-21 14:21

This is now a about your coolest PHP busy loop implementation.

I like this one most:

>> Marius (mm at co-operation dot de)

My solution providing usleep on a windows based os:


// Helper function
function getmicrotime(){
    list($usec, $sec) = explode(' ',microtime());
    return ((float)$usec + (float)$sec);
}

// usleep alias function for windows
function msleep($micro_seconds=0) {
    $stop  = getmicrotime() + ($miliseconds / 1000);
    while (getmicrotime() <= $stop) {
        // loop
    }
    return true;
}

Name: Anonymous 2012-12-21 14:23

I think this is also a GRAET SOLUTION, guys:


function usleepWindows($usec)
{
    $start = gettimeofday();

    do
    {
        $stop = gettimeofday();
        $timePassed = 1000000 * ($stop['sec'] - $start['sec'])
            + $stop['usec'] - $start['usec'];
    }
    while ($timePassed < $usec);
}


I also have endless amounts of while(1) loops. PHP [s]programmers[/p] are able to implement a while(1) loop in everything.

Name: Anonymous 2012-12-21 14:27


If you wonder how to end execution of a function (as I did), it's that simple: return

function foo($a) {
 if(!$a) return;
 echo 'true';
 // some other code
}

foo(true) will echo 'true', foo(false) won't echo anything (as return ends execution of the function. Of course, therefore there is no need for 'else' before 'echo').

Name: Anonymous 2012-12-21 14:29

Ok guys here something that I use and it works

<?php

                                                switch($_GET['id'])

{

default:
      echo "yourvalue\n";
      echo "yourvalue2\n";
break;

case banner:
      echo "content in banner\n";
      echo "another content in banner\n";
break;

case header:
      echo "content in header\n";
      echo "another content in header\n";
break;

case other:
      echo "content in other\n";
      echo "another content in other\n";
break;

}

?>

Now I will explain what each script does.

first part the

<?php

                                                switch($_GET['id'])

{

should be included or it won't work

default is default link, lets say if this is in index.php then when index.php is loaded default will be shown.

case banner: or case header: or case other: is what will be hidden until visitors click on link that will take them there, the value after case is going to be added after the name of the file, lets say case banner: is in index.php then case banner: and its contents will be in index.php?id=banner same for header and other cases. note that you always should put break; tag should be included.

Hope this helped you guys, I am sorry if i didn't explain it well but I tried my best.

Name: Anonymous 2012-12-21 14:36

Ultimate explanation to object references:
NOTE: wording 'points to' could be easily replaced with 'refers ' and is used loosly.

<?php
$a1 = new A(1);  // $a1 == handle1-1 to A(1)
$a2 = $a1;     // $a2 == handle1-2 to A(1) - assigned by value (copy)
$a3 = &$a1;  // $a3 points to $a1 (handle1-1)
$a3 = null;      // makes $a1==null, $a3 (still) points to $a1, $a2 == handle1-2 (same object instance A(1))
$a2 = null;      // makes $a2 == null
$a1 = new A(2); //makes $a1 == handle2-1 to new object and $a3 (still) points to $a1 => handle2-1 (new object), so value of $a1 and $a3 is the new object and $a2 == null
//By reference:
$a4 = &new A(4);  //$a4 points to handle4-1 to A(4)
$a5 = $a4;   // $a5 == handle4-2 to A(4) (copy)
$a6 = &$a4;  //$a6 points to (handle4-1), not to $a4 (reference to reference references the referenced object handle4-1 not the reference itself)

$a4 = &new A(40); // $a4 points to handle40-1, $a5 == handle4-2 and $a6 still points to handle4-1 to A(4)
$a6 = null;  // sets handle4-1 to null; $a5 == handle4-2 = A(4); $a4 points to handle40-1; $a6 points to null
$a6 =&$a4; // $a6 points to handle40-1
$a7 = &$a6; //$a7 points to handle40-1
$a8 = &$a7; //$a8 points to handle40-1
$a5 = $a7;  //$a5 == handle40-2 (copy)
$a6 = null; //makes handle40-1 null, all variables pointing to (hanlde40-1 ==null) are null, except ($a5 == handle40-2 = A(40))
?>


Hope this helps.

Name: Anonymous 2012-12-21 14:43

>>14
>>Hope this helps.
>>Hope this helps.
>>Hope this helps.
>>Hope this helps.
>>Hope this helps.

Name: Anonymous 2012-12-21 19:27

There are only two kinds of languages: the ones people complain about and the ones nobody uses.

Name: Anonymous 2012-12-21 19:28

>>16
Shalom, hymie!

Name: Anonymous 2012-12-21 20:57

>>12
IHBT

Name: Anonymous 2012-12-21 21:03

Is that some php.net copy pasta?

Name: Anonymous 2012-12-22 5:24

>>19

No this is the standard on PHP.net, no need for copy pasta there.

Name: Anonymous 2012-12-22 12:33

Stringly typed languages are the future.

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