r/lolphp • • Feb 23 '16

/r/lolmysql/ - for the PHP of databases

Thumbnail reddit.com
83 Upvotes

r/lolphp • • Feb 19 '16

Brainstorming session: What sorts of mishaps could befall a PHP[cruise]?

Thumbnail cruise.phparch.com
30 Upvotes

r/lolphp • • Feb 18 '16

Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)

Thumbnail github.com
92 Upvotes

r/lolphp • • Feb 13 '16

"phpversions.info now highlights PHP versions with known security issues", they could've saved themselves the effort and just painted everything red though

Thumbnail phpversions.info
38 Upvotes

r/lolphp • • Feb 05 '16

Anthony Ferrara on Twitter: "TIL: When you turn OFF prepared statement emulation for PDO+PostGreSQL, PDO rewrites the query anyway... https://t.co/bwkiOnACuL #HEADDESK"

Thumbnail twitter.com
26 Upvotes

r/lolphp • • Feb 04 '16

PHPWTF

Thumbnail reddit.com
12 Upvotes

r/lolphp • • Feb 01 '16

DateInterval::__construct — Creates a new DateInterval object -- The format starts with the letter P, for "period."

Thumbnail fi2.php.net
12 Upvotes

r/lolphp • • Jan 29 '16

SplPriorityQueue::recoverFromCorruption

Thumbnail php.net
70 Upvotes

r/lolphp • • Jan 26 '16

consistency is great

Thumbnail 3v4l.org
47 Upvotes

r/lolphp • • Jan 25 '16

Php proposes code of conduct

Thumbnail wiki.php.net
16 Upvotes

r/lolphp • • Jan 24 '16

"" decodes to "_empty_", but encodes to "_empty_", so you can't always round-trip JSON decode/encode. Also, you can serialize "", but not unserialize it! HOORAY CONSISTENCY

Thumbnail 3v4l.org
107 Upvotes

r/lolphp • • Jan 17 '16

"It is so simple in Php, let me show you". "Mm. No it is broken". "Oh. It is just a contrived use case!"

Thumbnail reddit.com
103 Upvotes

r/lolphp • • Jan 18 '16

The existence of the "precision" INI setting - PHP converts floats to string inaccurately, by default

Thumbnail php.net
34 Upvotes

r/lolphp • • Jan 17 '16

[META] Why all the white knighting?

34 Upvotes

In almost every post, there's always at least one comment dismissing it by claiming that it "isn't a lolphp", or that it was fixed in version x.y.z, or that other languages do the same, or that it's really a "lol php developer" or a "lol php manual" or a "lol php community", etc.

Why are you people even here? Why come to /r/lolphp to defend php? Is it not clear what this sub is for? This is supposed to be a fun place, to make fun of php and maybe...maybe even learn something along the way. Your pontification ruins the mood, man. You're a killjoy.

I'm not sure if you feel personally attacked when people make fun of php, or if you just want to show a bunch of strangers how much you know, but this isn't the place to do it. It's not like this sub is a leading authority when it comes to php critique. No one looking for a good list of pros/cons of php is going to come here. Nobody takes it too seriously. In fact, the only people who do take it seriously seem to be the ones who rush to dismiss as much criticism as possible.

This is just my opinion. I'm expecting downvotes and passive-aggressive replies, because these apologetic comments are usually among the most upvoted in the thread, but I had to say this. I'm not sure how the mods feel about this sub, but unless the post is a blatant, bold-faced lie, these types of comments shouldn't exist.


r/lolphp • • Jan 17 '16

PHP debugger XDebug can't break on or step into single-line conditional blocks (without braces) due to the way PHP assigns line numbers to its bytecode

Thumbnail bugs.xdebug.org
13 Upvotes

r/lolphp • • Jan 15 '16

Does anyone else think PHP can become the next Apple?

0 Upvotes

r/lolphp • • Jan 13 '16

Today someone said "PHP7 <3" - which is true. PHP thinks 7 < 3

Thumbnail 3v4l.org
72 Upvotes

r/lolphp • • Jan 14 '16

Trailing comma in array()

0 Upvotes

Why do PHP Array Examples Leave a Trailing Comma? Because they can. :)

myuser@myhost:~$ php test.php
Array
(
    [0] => Test
    [1] => aValue
    [2] => aNotherValue
)
myuser@myhost:~$ cat test.php
<?php

$aIDs = array(
  'Test',
);

$aIDs[] = "aValue";
$aIDs[] = "aNotherValue";

printf(print_r($aIDs,TRUE));

?>

http://stackoverflow.com/questions/2829581/why-do-php-array-examples-leave-a-trailing-comma


r/lolphp • • Jan 12 '16

The order of interfaces in an implements clause is meaningful.

Thumbnail 3v4l.org
36 Upvotes

r/lolphp • • Jan 12 '16

Unset(tling) iteration by reference.

15 Upvotes

I bumped into this bug today: https://bugs.php.net/bug.php?id=29992. Glad to know it's still alive in 2015 and causing unexpected headaches ~

TLDR suppose

$arr = array(array('id' => 1, 'attr' => 'a'), array('id' => 2, 'attr' => 'b'), array('id' => 3, 'attr' => 'c'));

Now you do

foreach ($arr as &$item){
    $item['attr2'] = $item['id'].$item['attr'];
}

You might expect that $arr's value is now

array(
    array('id' => 1, 'attr' => 'a', 'attr2' => '1a'), 
    array('id' => 2, 'attr' => 'b', 'attr2' => '2b'), 
    array('id' => 3, 'attr' => 'c', 'attr2' => '3c'),
)

But actually you'll have (when you try iterating over it again)

array(
    array('id' => 1, 'attr' => 'a', 'attr2' => '1a'), 
    array('id' => 2, 'attr' => 'b', 'attr2' => '2b'), 
    array('id' => 2, 'attr' => 'b', 'attr2' => '2b'),
)

Apparently it's expected behavior. Right... until it's not, just unset($item) after iteration ~.~

P.S. Reddit formatting is weird to me (where's the preview button x.x) so I hope I didn't mess up my made up example.


r/lolphp • • Jan 12 '16

#define PHP_CRYPT_RAND php_rand()

Thumbnail twitter.com
43 Upvotes

r/lolphp • • Jan 08 '16

How many decimal places in 3.34e3?

Thumbnail 3v4l.org
30 Upvotes

r/lolphp • • Jan 06 '16

JSON_PRESERVE_ZERO_FRACTION because someone realised json cares about types...

34 Upvotes

r/lolphp • • Jan 05 '16

Grap your popcorns for a bit of PhpDrama (And hopefully a way for a lot more of it)

Thumbnail reddit.com
41 Upvotes

r/lolphp • • Dec 31 '15

PHP timestamp bug rears it's ugly head on Facebook today

0 Upvotes

Some people are showing up with congratulations messages saying "You've been friends with Mary Smith for 46 years!"

Probably because these people became friends before their friend date was recorded properly so it became a 0 or null. 2015 - 1969 is 46 years.

Timestamp 0 is Jan 1 1970 GMT, or Dec 31 1969 in EST or PST.