subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | SirClueless | f0f4rai | <|sols|><|sot|>PHP is whitespace insensitive, except when it isn't.<|eot|><|sol|>https://i.redd.it/z4uixvzsssm31.png<|eol|><|soopr|>PhpStorm doesn't catch this.
Half of the online sandboxes I tested displayed the above behaviour (e.g. [http://phpfiddle.org/](http://phpfiddle.org/)) and the rest threw an error.<|eoopr... | 11 |
lolphp | Vinnie420 | f0exv65 | <|sols|><|sot|>PHP is whitespace insensitive, except when it isn't.<|eot|><|sol|>https://i.redd.it/z4uixvzsssm31.png<|eol|><|sor|>Thats because you are using the wrong syntax for if statements in html
When using :
<?php if (true): ?>
<div>Hello</div>
<?php endif ?>
<?php if (false): ?>
<div>SECRE... | 7 |
lolphp | SirClueless | f0gx1ea | <|sols|><|sot|>PHP is whitespace insensitive, except when it isn't.<|eot|><|sol|>https://i.redd.it/z4uixvzsssm31.png<|eol|><|sor|>Whitespace insensitive means that multiple whitespace characters can be collapsed into one. Not that whitespace can be removed entirely. Consider a trivial case like `return foo;`. Replacing... | 7 |
lolphp | khoyo | f0fuc2x | <|sols|><|sot|>PHP is whitespace insensitive, except when it isn't.<|eot|><|sol|>https://i.redd.it/z4uixvzsssm31.png<|eol|><|sor|>Whitespace insensitive means that multiple whitespace characters can be collapsed into one. Not that whitespace can be removed entirely. Consider a trivial case like `return foo;`. Replacing... | 6 |
lolphp | Vinnie420 | f0f2ekj | <|sols|><|sot|>PHP is whitespace insensitive, except when it isn't.<|eot|><|sol|>https://i.redd.it/z4uixvzsssm31.png<|eol|><|sor|>Thats because you are using the wrong syntax for if statements in html
When using :
<?php if (true): ?>
<div>Hello</div>
<?php endif ?>
<?php if (false): ?>
<div>SECRE... | 5 |
lolphp | MazeChaZer | 4fuam3 | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|eols|><|endoftext|> | 99 |
lolphp | Genmutant | d2c0y7s | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 43 |
lolphp | MazeChaZer | d2c2yni | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 29 |
lolphp | b1ackcat | d2c1cam | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 25 |
lolphp | barubary | d2czd8t | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 24 |
lolphp | EvilTerran | d2c8473 | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>The precedence rules in Perl (and, according to a quick test, in Javascript too) make a lot more sense to me, as it's evaluated like
true ? 'car' : ( false ? 'horse' : 'feet'... | 18 |
lolphp | greyfade | d2c2xnf | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 14 |
lolphp | barubary | d2czo7a | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>Am I the only one not confused by this? The ternary operations evaluate left to right, and non-empty strings are implicitly true. So the path of true -> 'Car' -> 'Horse' makes sens... | 13 |
lolphp | h0rst_ | d2c2txf | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 13 |
lolphp | MazeChaZer | d2bzuno | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|soopr|>The related [PHP Sadness](http://www.phpsadness.com/sad/30) article has already been here [a few years ago](https://www.reddit.com/r/lolphp/comments/ywk69/ternary_operator_true_l... | 12 |
lolphp | shvelo | d2c3re0 | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>let's add parentheses for clarity
(true ? 'car' : false) ? 'horse' : 'feet'
(true ? 'car' : false) will evaluate to 'car'
'car' ? 'horse' : 'feet'
since non-empty st... | 10 |
lolphp | BilgeXA | d2cegyr | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I find it ironic that by posting this you're also beating a dead horse.<|eor|><|eols|><|endoftext|> | 9 |
lolphp | Vakieh | d2cdm4f | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>Nested ternaries is a fireable offence in any decent shop regardless of the language.
When syntactic sugar tastes like shit what good is it?<|eor|><|eols|><|endoftext|> | 9 |
lolphp | masklinn | d2elpxx | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 9 |
lolphp | kovensky | d2cu5xx | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 8 |
lolphp | bart2019 | d2c6vk6 | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>The precedence rules in Perl (and, according to a quick test, in Javascript too) make a lot more sense to me, as it's evaluated like
true ? 'car' : ( false ? 'horse' : 'feet'... | 7 |
lolphp | DoctorWaluigiTime | d2d03w7 | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 7 |
lolphp | cparen | d2c95ut | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>The precedence rules in Perl (and, according to a quick test, in Javascript too) make a lot more sense to me, as it's evaluated like
true ? 'car' : ( false ? 'horse' : 'feet'... | 6 |
lolphp | ReversedGif | d2cavcs | <|sols|><|sot|>The behavior of the ternary operator is sensible and straightforward<|eot|><|sol|>https://i.imgur.com/1zgFd.jpg<|eol|><|sor|>I actually don't understand what the hell it's doing that results in that. Can someone break it down and explain it slowly?<|eor|><|sor|> TRUE ? 'CAR' : FALSE ? 'HORSE' : 'FEET'... | 6 |
lolphp | Hauleth | 4z5ss3 | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|eols|><|endoftext|> | 95 |
lolphp | Hauleth | d6t4fmw | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 28 |
lolphp | the_alias_of_andrea | d6tdds9 | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 28 |
lolphp | MMauro94 | d6tkkj7 | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>I'm just gonna change *some* code...brb<|eor|><|eols|><|endoftext|> | 20 |
lolphp | masklinn | d6t5dcb | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 18 |
lolphp | maweki | d6t61fa | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 13 |
lolphp | masklinn | d6t5ucs | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 12 |
lolphp | Hauleth | d6t5vsc | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 11 |
lolphp | Hauleth | d6t6azi | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 9 |
lolphp | masklinn | d6t5vcp | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 7 |
lolphp | Hauleth | d6tlzhu | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 6 |
lolphp | hylje | d6t6f8w | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 6 |
lolphp | allthediamonds | d6wp8ne | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|sor|>Not knowing what magical in... | 5 |
lolphp | Various_Pickles | d6vlqe1 | <|sols|><|sot|>If array contain true and false then it also contain everything else.<|eot|><|sol|>http://sandbox.onlinephpfunctions.com/code/acac39a42fa6d6592053c972995fbbbd9d8b9e18<|eol|><|sor|>This is why you always use `in_array($a, $b, true)`.
Half lolphp half loldeveloper.<|eor|><|soopr|>Half lolphp half lol `==`... | 5 |
lolphp | sarciszewski | 3fct2t | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|eols|><|endoftext|> | 93 |
lolphp | manuscelerdei | ctnp6jr | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 62 |
lolphp | Aquatakat | ctns89h | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 46 |
lolphp | Sebbe | ctnqy95 | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 45 |
lolphp | IForgetMyself | ctnufmb | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>[deleted]<|eor|><|sor|>I downvoted you for sheer stupidity, then I saw the footer... Poe's law in action I guess. <|eor|><|eo... | 27 |
lolphp | polish_niceguy | ctntazp | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 26 |
lolphp | caffeinep0wered | ctnt869 | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 23 |
lolphp | ThisIsADogHello | ctnwcu3 | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 23 |
lolphp | thelordofcheese | ctnwl13 | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 13 |
lolphp | myaut | ctp5i5s | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>The real lolphp here is that availability of `/dev/urandom` or `/dev/arandom` is checked statically using compile-time direct... | 10 |
lolphp | CornPlanter | ctntoqw | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>[deleted]<|eor|><|sor|>Because here, in planet reality, where we write software that enough people care about to be hit by ex... | 10 |
lolphp | amphetamachine | ctnpzny | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 6 |
lolphp | sarciszewski | ctol2sq | <|sols|><|sot|>Why PHP sucks at security: people arguing against security because it's "consistent" with existing bad practices.<|eot|><|sol|>http://news.php.net/php.internals/87473<|eol|><|sor|>> This can be wrapped in an oop wrapper in userland if somebody prefers and exception but would still keep the procedural sty... | 6 |
lolphp | Daniel15 | 2hedsm | <|sols|><|sot|>"The root of the problem is that HHVM implements Memcached::increment/decrement as they are documented, rather than how PHP5 actually behaves"<|eot|><|sol|>https://github.com/facebook/hhvm/issues/3839<|eol|><|eols|><|endoftext|> | 93 |
lolphp | Various_Pickles | ckscgse | <|sols|><|sot|>"The root of the problem is that HHVM implements Memcached::increment/decrement as they are documented, rather than how PHP5 actually behaves"<|eot|><|sol|>https://github.com/facebook/hhvm/issues/3839<|eol|><|sor|>Convert whatever object is causing the issue to a string (completely ignore locale or assum... | 14 |
lolphp | masterwit | ckssk7v | <|sols|><|sot|>"The root of the problem is that HHVM implements Memcached::increment/decrement as they are documented, rather than how PHP5 actually behaves"<|eot|><|sol|>https://github.com/facebook/hhvm/issues/3839<|eol|><|sor|>This subreddit has convinced me to never seriously learn PHP... thank fucking god.<|eor|><|... | 7 |
lolphp | i-am-am-nice-really | jqn3t | <|sols|><|sot|>5.3.7 Fails unit test, released anyway<|eot|><|sol|>https://bugs.php.net/bug.php?id=55439<|eol|><|eols|><|endoftext|> | 94 |
lolphp | _SynthesizerPatel_ | c2eh4f2 | <|sols|><|sot|>5.3.7 Fails unit test, released anyway<|eot|><|sol|>https://bugs.php.net/bug.php?id=55439<|eol|><|sor|>Read the headline as [this](http://i.imgur.com/cAvSr.jpg)<|eor|><|eols|><|endoftext|> | 12 |
lolphp | tonygoold | c2eez2e | <|sols|><|sot|>5.3.7 Fails unit test, released anyway<|eot|><|sol|>https://bugs.php.net/bug.php?id=55439<|eol|><|soopr|>Anyway guess who did it :
"let's use strlcpy/strlcat instead for these static string copies" - Rasmus
I guess that's Lerdorf himself
Here's where he broke it : Sun Aug 7 16:10:34 2011 UTC
http://sv... | 8 |
lolphp | i-am-am-nice-really | c2ed2qs | <|sols|><|sot|>5.3.7 Fails unit test, released anyway<|eot|><|sol|>https://bugs.php.net/bug.php?id=55439<|eol|><|soopr|>Anyway guess who did it :
"let's use strlcpy/strlcat instead for these static string copies" - Rasmus
I guess that's Lerdorf himself
Here's where he broke it : Sun Aug 7 16:10:34 2011 UTC
http://sv... | 7 |
lolphp | Takeoded | hj6p07 | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|eols|><|endoftext|> | 94 |
lolphp | stfcfanhazz | fwkgao7 | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>Weird. Just when i thought i had the loose comparison type juggling figured out, apparently integer 0 causes literally any string that doesnt start with a numeric character to be equal.
Integer 0 is "falsey" in PHP, but a filled string... | 55 |
lolphp | marcio0 | fwkx9r7 | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>inb4 "it's documented therefore it's correct"<|eor|><|eols|><|endoftext|> | 19 |
lolphp | f0rc3u2 | fwkk072 | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>Weird. Just when i thought i had the loose comparison type juggling figured out, apparently integer 0 causes literally any string that doesnt start with a numeric character to be equal.
Integer 0 is "falsey" in PHP, but a filled string... | 18 |
lolphp | gevrik | fwkvkiv | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>Weird. Just when i thought i had the loose comparison type juggling figured out, apparently integer 0 causes literally any string that doesnt start with a numeric character to be equal.
Integer 0 is "falsey" in PHP, but a filled string... | 13 |
lolphp | Takeoded | fwkfboa | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|soopr|>come to think of it, PHP8 would be a good time to BC-break-fix whatever the fuck that is, wouldn't it? (bet they can't fix it in PHP7)<|eoopr|><|eols|><|endoftext|> | 12 |
lolphp | jmcs | fwl3tyr | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>...wait, is it somehow reading that string as NaN, and just saying sure, falsey == falsey?<|eor|><|sor|>`(int)"gfsdgsfdgsdf" === 0` because logic is a potato.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | f0rc3u2 | fwkyagj | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>Weird. Just when i thought i had the loose comparison type juggling figured out, apparently integer 0 causes literally any string that doesnt start with a numeric character to be equal.
Integer 0 is "falsey" in PHP, but a filled string... | 8 |
lolphp | Takeoded | fwn7c9y | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>You asked a stupid question and got a stupid answer. Not LOLPHP material.<|eor|><|soopr|>In no sane high-level language is `0` == `gfsdgsfdgsdf`, just ask Python or JavaScript
i know the `==` operator is like the `kindof-equal` opera... | 7 |
lolphp | ricdesi | fwl2kcs | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>...wait, is it somehow reading that string as NaN, and just saying sure, falsey == falsey?<|eor|><|eols|><|endoftext|> | 6 |
lolphp | Jonno_FTW | fwnqs0k | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|soopr|>come to think of it, PHP8 would be a good time to BC-break-fix whatever the fuck that is, wouldn't it? (bet they can't fix it in PHP7)<|eoopr|><|sor|>[deleted]<|eor|><|sor|>When is this kind of type coercion ever going to be useful?
... | 5 |
lolphp | bart2019 | g0k8svt | <|sols|><|sot|>0 == "gfsdgsfdgsdf"<|eot|><|sol|>https://3v4l.org/j8vDJ<|eol|><|sor|>Here's another similar one for fun:
>php -r "var_dump('OK' == true);"
bool(true)<|eor|><|sor|>>var\_dump('OK' == true);
[https://www.php.net/manual/en/types.comparisons.php](https://www.php.net/manual/en/types.comparisons.php... | 5 |
lolphp | dotancohen | 7sun0m | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 93 |
lolphp | maweki | dt7ppyo | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 49 |
lolphp | dagbrown | dt7qedo | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 19 |
lolphp | kr094 | dt7q7be | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 19 |
lolphp | masklinn | dtf10wi | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 11 |
lolphp | dagbrown | dtcujuq | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 10 |
lolphp | ciaranmcnulty | dtcuf4s | <|soss|><|sot|>ldap_connect() Note: This function does not open a connection<|eot|><|sost|>Apparently the fine function [ldap_connect()](http://php.net/manual/en/function.ldap-connect.php) creates an LDAP link identifier and checks whether the given host and port are plausible.
IT DOES NOT OPEN A CONNECTION.
Naming t... | 6 |
lolphp | PuffyHerb | c395nr | <|sols|><|sot|>Using DateTime::ISO8601 is incompatible with ISO-8601 but left broken for backward compatibility. Use DateTime::ATOM instead when you need ISO8601<|eot|><|sol|>https://i.redd.it/3zjxohvaxo531.png<|eol|><|eols|><|endoftext|> | 91 |
lolphp | Rogue2166 | erpf0m8 | <|sols|><|sot|>Using DateTime::ISO8601 is incompatible with ISO-8601 but left broken for backward compatibility. Use DateTime::ATOM instead when you need ISO8601<|eot|><|sol|>https://i.redd.it/3zjxohvaxo531.png<|eol|><|sor|>Jesus php, get the fuck out of here<|eor|><|eols|><|endoftext|> | 19 |
lolphp | TheHalfBloodFriendly | erpqc4r | <|sols|><|sot|>Using DateTime::ISO8601 is incompatible with ISO-8601 but left broken for backward compatibility. Use DateTime::ATOM instead when you need ISO8601<|eot|><|sol|>https://i.redd.it/3zjxohvaxo531.png<|eol|><|sor|>Gotta love their comments on the issue tracker stating its not a bug
> [https://bugs.php.net/bu... | 18 |
lolphp | shaql | erww8c0 | <|sols|><|sot|>Using DateTime::ISO8601 is incompatible with ISO-8601 but left broken for backward compatibility. Use DateTime::ATOM instead when you need ISO8601<|eot|><|sol|>https://i.redd.it/3zjxohvaxo531.png<|eol|><|sor|>Duplicate of https://www.reddit.com/r/lolphp/comments/4oacnc/php_and_iso_8601_from_phpnet_link_i... | 6 |
lolphp | Daniel15 | 5am6dz | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|eols|><|endoftext|> | 92 |
lolphp | Daniel15 | d9hhw9w | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|soopr|> function lol(): boolean {
return true;
}
lol();
Results in:
Uncaught TypeError: Return value of lol() must be an instance of boolean, boolean returned
Because the type is actuall... | 53 |
lolphp | polish_niceguy | d9hq50q | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|soopr|> function lol(): boolean {
return true;
}
lol();
Results in:
Uncaught TypeError: Return value of lol() must be an instance of boolean, boolean returned
Because the type is actuall... | 36 |
lolphp | shvelo | d9i6npy | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|soopr|> function lol(): boolean {
return true;
}
lol();
Results in:
Uncaught TypeError: Return value of lol() must be an instance of boolean, boolean returned
Because the type is actuall... | 20 |
lolphp | Daniel15 | d9hljxl | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|soopr|> function lol(): boolean {
return true;
}
lol();
Results in:
Uncaught TypeError: Return value of lol() must be an instance of boolean, boolean returned
Because the type is actuall... | 19 |
lolphp | sloat | d9hla62 | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|soopr|> function lol(): boolean {
return true;
}
lol();
Results in:
Uncaught TypeError: Return value of lol() must be an instance of boolean, boolean returned
Because the type is actuall... | 15 |
lolphp | Vakieh | d9iaxqx | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|sor|>This is why php should have just embraced its own truthiness and called all return types "something". It can probably auto cast from everything to everything, so just run with it.<|eor|><|eols|><|endoftext... | 10 |
lolphp | kkjdroid | d9idj6o | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|sor|>This is why php should have just embraced its own truthiness and called all return types "something". It can probably auto cast from everything to everything, so just run with it.<|eor|><|sor|>At that poin... | 7 |
lolphp | hylje | d9jsojr | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|sor|>This is why php should have just embraced its own truthiness and called all return types "something". It can probably auto cast from everything to everything, so just run with it.<|eor|><|sor|>At that poin... | 6 |
lolphp | Daniel15 | d9izmac | <|sols|><|sot|>"must be an instance of boolean, boolean returned"<|eot|><|sol|>https://3v4l.org/qLv4E<|eol|><|sor|>This is why php should have just embraced its own truthiness and called all return types "something". It can probably auto cast from everything to everything, so just run with it.<|eor|><|sor|>At that poin... | 5 |
lolphp | maweki | 46fxi8 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|eols|><|endoftext|> | 92 |
lolphp | midir | d04y0q0 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>So in the future we'll have:
* rand Generate a random integer
* mt_rand Generate a better random integer... | 58 |
lolphp | phoshi | d04tgtq | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an import... | 41 |
lolphp | cbraga | d058dkk | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>So in the future we'll have:
* rand Generate a random integer
* mt_rand Generate a better random integer... | 25 |
lolphp | outadoc | d054jds | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an import... | 22 |
lolphp | Scaliwag | d053lo0 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statist... | 20 |
lolphp | kerzen1 | d04qeb4 | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>Did anyone check the output of the broken Mersenne-Twister if it's even random?
(to the point that statist... | 19 |
lolphp | phoshi | d04v1fy | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>This commit is unfortunately not wrong. Producing repeatable sequences of pseudorandom numbers is an import... | 18 |
lolphp | the_alias_of_andrea | d054e8m | <|sols|><|sot|>Typofixing commit in Mersenne twister RNG code is reverted (because code might depend on it)<|eot|><|sol|>https://github.com/php/php-src/commit/a0724d30817600540946b41e40f4cfc2a0c30f80<|eol|><|sor|>So in the future we'll have:
* rand Generate a random integer
* mt_rand Generate a better random integer... | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.