subreddit stringclasses 7
values | author stringlengths 3 20 | id stringlengths 5 7 | content stringlengths 67 30.4k | score int64 0 140k |
|---|---|---|---|---|
lolphp | barubary | donjy7 | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|eoss|><|endoftext|> | 105 |
lolphp | shaql | f5p7rfs | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>Reading so many PHP manual pages is bad for your health, please consider taking a break :(<|eor|><|eoss|><|endoftext|> | 45 |
lolphp | philipwhiuk | f5p75xc | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>Now this is actual lolphp :)<|eor|><|eoss|><|endoftext|> | 27 |
lolphp | bart2019 | f5p913q | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>`include`is an expression, not a statement. You can `return` a value in the included file, which will be used as the return value of `include`. That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file. Much faster than parsing an INI file.
Yeah, probably the behavior changed after the manual entry was written, and they forgot to update it.
Don't use something like `include $file or die("zoink");` to check if include() failed, but use `require` instead.<|eor|><|eoss|><|endoftext|> | 17 |
lolphp | barubary | f5scnsz | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>`include`is an expression, not a statement. You can `return` a value in the included file, which will be used as the return value of `include`. That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file. Much faster than parsing an INI file.
Yeah, probably the behavior changed after the manual entry was written, and they forgot to update it.
Don't use something like `include $file or die("zoink");` to check if include() failed, but use `require` instead.<|eor|><|soopr|>> That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file.
That sounds like what a lot of Perl code used to do:
my $config = do("./config.pl");
Some time in the early noughties people realized that having arbitrary code execution in your config file is probably a bad idea. Also, using a standard format for config data means you can actually provide tooling around it (instead of relying on a human programmer to "configure" things) and reuse it in different applications / programming languages.
> Much faster than parsing an INI file.
That just means your INI parser is horribly slow. Besides, who cares about the performance of parsing a (usually pretty small) config file? It only happens once, when the application starts up.<|eoopr|><|eoss|><|endoftext|> | 8 |
lolphp | barubary | f5t5erw | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>`include`is an expression, not a statement. You can `return` a value in the included file, which will be used as the return value of `include`. That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file. Much faster than parsing an INI file.
Yeah, probably the behavior changed after the manual entry was written, and they forgot to update it.
Don't use something like `include $file or die("zoink");` to check if include() failed, but use `require` instead.<|eor|><|soopr|>> That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file.
That sounds like what a lot of Perl code used to do:
my $config = do("./config.pl");
Some time in the early noughties people realized that having arbitrary code execution in your config file is probably a bad idea. Also, using a standard format for config data means you can actually provide tooling around it (instead of relying on a human programmer to "configure" things) and reuse it in different applications / programming languages.
> Much faster than parsing an INI file.
That just means your INI parser is horribly slow. Besides, who cares about the performance of parsing a (usually pretty small) config file? It only happens once, when the application starts up.<|eoopr|><|sor|>Which is, in a web context, on every page load.<|eor|><|soopr|>Lol wut? No, it's not. Unless you're using CGI, but why would you do that in 2019?
---
*Edit:* Or if you decide to explicitly re-read the config file before dispatching each incoming request, but again: Why would you do that?<|eoopr|><|sor|>PHP. Ever heard of that? It seems like most of the webdev world uses it.<|eor|><|soopr|>Wait, are you telling me that every PHP web app out there is essentially deployed in "CGI mode" where it re-parses and executes the whole application for each request?
Don't they know we have better options now? FastCGI, web server integration modules, custom app servers, WSGI/PSGI/Rack, ... and combinations thereof?<|eoopr|><|eoss|><|endoftext|> | 7 |
lolphp | ranisalt | f5pzsve | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>`include or die` actually sounds great<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | shaql | f5scihk | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>On Mac OSX using PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS ).
>$ php -r '42 + include "/";'
>
>Warning: include(/): failed to open stream: Undefined error: 0 in Command line code on line 1
>
>Warning: include(): Failed opening '/' for inclusion (include\_path='.:') in Command line code on line 1
My version throws a warning about the `include_path`, so this might also be a factor.<|eor|><|sor|>> Undefined error: 0
Well, error number 0 usually means success, so that makes 'sense'. Um.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | bitfxxker | f5p2lp0 | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>On Mac OSX using PHP 7.1.23 (cli) (built: Feb 22 2019 22:19:32) ( NTS ).
>$ php -r '42 + include "/";'
>
>Warning: include(/): failed to open stream: Undefined error: 0 in Command line code on line 1
>
>Warning: include(): Failed opening '/' for inclusion (include\_path='.:') in Command line code on line 1
My version throws a warning about the `include_path`, so this might also be a factor.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | sproingie | f7bv1ut | <|soss|><|sot|>The include "statement"<|eot|><|sost|>As [the PHP manual says](https://www.php.net/manual/en/function.include.php):
> The *include* statement includes and evaluates the specified file.
The first example demonstrates the syntax:
include 'vars.php';
Of course, that's misleading because:
> *include* returns *FALSE* on failure and raises a warning. Successful includes, unless overridden by the included file, return *1*.
Sample usage:
$foo = include 'return.php';
How can a statement return a value? What's the "return value" of a `while` loop or `continue` or `class`?
As it turns out, `include` (and its variants: `include_once`, `require`, `require_once`) are actually unary operators at a very low precedence level. This is undocumented, of course.
include $foo or die("zoinks");
// parses as:
include ($foo or die("zoinks"));
This is subtly different from `yield` and `print`, which are also unary operators, but have higher precedence than e.g. `or`.
(The manual does say that `include('vars.php') == TRUE` parses as `include ('vars.php' == TRUE)`, but it does not say what the actual precedence is, and `include` is missing from [the big operator precedence table](https://www.php.net/manual/en/language.operators.precedence.php).)
Finally, I have no idea what's going on here:
$ php -r '42 + include "/";'
Warning: include(/): failed to open stream: Success
... I guess `include` failed successfully?
---
*Edit:* For bonus consistency, the manual says it's a statement, but it actually works like an operator, but the link goes to `/manual/en/function.include.php` (so I guess it's a function?), but it's in the *Control Structures* chapter of the documentation (along with `if` / `while` / `switch` / `goto` / etc.), so take your pick.<|eost|><|sor|>`include`is an expression, not a statement. You can `return` a value in the included file, which will be used as the return value of `include`. That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file. Much faster than parsing an INI file.
Yeah, probably the behavior changed after the manual entry was written, and they forgot to update it.
Don't use something like `include $file or die("zoink");` to check if include() failed, but use `require` instead.<|eor|><|soopr|>> That is very handy, Zend Framework uses that in order to use a PHP file as a config file: you just return an array of settings in the included file.
That sounds like what a lot of Perl code used to do:
my $config = do("./config.pl");
Some time in the early noughties people realized that having arbitrary code execution in your config file is probably a bad idea. Also, using a standard format for config data means you can actually provide tooling around it (instead of relying on a human programmer to "configure" things) and reuse it in different applications / programming languages.
> Much faster than parsing an INI file.
That just means your INI parser is horribly slow. Besides, who cares about the performance of parsing a (usually pretty small) config file? It only happens once, when the application starts up.<|eoopr|><|sor|>Which is, in a web context, on every page load.<|eor|><|soopr|>Lol wut? No, it's not. Unless you're using CGI, but why would you do that in 2019?
---
*Edit:* Or if you decide to explicitly re-read the config file before dispatching each incoming request, but again: Why would you do that?<|eoopr|><|sor|>PHP. Ever heard of that? It seems like most of the webdev world uses it.<|eor|><|soopr|>Wait, are you telling me that every PHP web app out there is essentially deployed in "CGI mode" where it re-parses and executes the whole application for each request?
Don't they know we have better options now? FastCGI, web server integration modules, custom app servers, WSGI/PSGI/Rack, ... and combinations thereof?<|eoopr|><|sor|>PHP logically acts like a CGI, yes, in that it re-executes the entire bloody goddam f**ing application every request -- you can tell I've had to deal with this. Frameworks are limited in what they can do on startup since you pay that cost on every request.
Under the surface, PHP does keep the interpreter and even most of its state "warm" so the startup cost isn't _as_ much an issue, but it's still a bottleneck from hell. Thankfully the PHP world has started to wake up to the fact that SAPI basically sucks, and running your own http server is a thing one should try to do in the language itself. Thus stuff like ReactPHP, AMP, and Swoole, which drag PHP into the 21st century in that respect.
Shared PHP deployments on cheap servers are still going to keep using the CGI approach though.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | tjlevine | 3x4k2h | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|eols|><|endoftext|> | 107 |
lolphp | BilgeXA | cy1h0ej | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|eols|><|endoftext|> | 49 |
lolphp | n0rs | cy23yi6 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>You can also increment letter number combinations like "2d8"++ which becomes "2d9" then becomes "3e0" which then gets interpreted as the number 3e0 then increments to 4...<|eor|><|eols|><|endoftext|> | 46 |
lolphp | Drainedsoul | cy1wpt8 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|eols|><|endoftext|> | 43 |
lolphp | wutf | cy1h57f | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>This is actually wrong. It stops at yz, because za is already greater than z.
https://3v4l.org/6qfcf<|eor|><|eols|><|endoftext|> | 33 |
lolphp | SirClueless | cy1m0eu | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>This is not obvious in many HLL's. Python:
range('a', 'z')
# TypeError: range() integer end argument expected, got str.
map(chr, range(ord('a'), ord('z')+1))
In fact I think most languages that I've used in the past 20 years or so do not have a separate char type, they just use string types. C is the outlier, not the norm.<|eor|><|sor|>Fine, you use a string type and don't have anything like a "char". I'm cool with that until you make strings support ++. Then wtf are you smoking.<|eor|><|eols|><|endoftext|> | 31 |
lolphp | galaktos | cy1hv0e | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|eols|><|endoftext|> | 29 |
lolphp | Schmittfried | cy29d4e | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>You can also increment letter number combinations like "2d8"++ which becomes "2d9" then becomes "3e0" which then gets interpreted as the number 3e0 then increments to 4...<|eor|><|sor|>wot<|eor|><|eols|><|endoftext|> | 24 |
lolphp | prewk | cy1zrsb | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>Let's sum up the important question to 90% of the posts in this sub:
> How could you think that [Silly thing happening due to loosely typed language decisions] is a good idea or that it would give sensible results?
(I love the last 10%, though)<|eor|><|eols|><|endoftext|> | 21 |
lolphp | n0rs | cy31fon | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>You can also increment letter number combinations like "2d8"++ which becomes "2d9" then becomes "3e0" which then gets interpreted as the number 3e0 then increments to 4...<|eor|><|sor|>wot<|eor|><|sor|>https://3v4l.org/JCMlK<|eor|><|sor|>Ah, now I get it. It switches from hexadecimal to exponential notation when incrementing...this is..I don't even.<|eor|><|sor|>Not quite hexadecimal. You can just increment number letter combinations...
letter example: https://3v4l.org/AhLSg
hex example: https://3v4l.org/G16Ks
Hmm, I wonder if...
oh god... https://3v4l.org/uRGi0<|eor|><|eols|><|endoftext|> | 21 |
lolphp | Schmittfried | cy2ggs9 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>You can also increment letter number combinations like "2d8"++ which becomes "2d9" then becomes "3e0" which then gets interpreted as the number 3e0 then increments to 4...<|eor|><|sor|>wot<|eor|><|sor|>https://3v4l.org/JCMlK<|eor|><|sor|>PHP level: PHP<|eor|><|eols|><|endoftext|> | 20 |
lolphp | qubedView | cy1y1xl | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>"I was gonna get a candy bar; the button I was supposed to push was "HH", so I went to the side, I found the "H" button, I pushed it twice. Fuckin'...potato chips came out, man, because they had an "HH" button for Christ's sake! You need to let me know. I'm not familiar with the concept of "HH". I did not learn my AA-BB-CC's. God-god dammit-dammit." - Mitch Hedberg<|eor|><|eols|><|endoftext|> | 17 |
lolphp | Schmittfried | cy21ngw | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>Let's sum up the important question to 90% of the posts in this sub:
> How could you think that [Silly thing happening due to loosely typed language decisions] is a good idea or that it would give sensible results?
(I love the last 10%, though)<|eor|><|sor|>It's not due to loose typing. You can do computations on characters in pretty many languages. This is definitely one of the 10% stupid fuckups of PHP.<|eor|><|eols|><|endoftext|> | 14 |
lolphp | Schmittfried | cy21okz | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Excel column naming.
Also, it fits with the usual comparison rules for strings.<|eor|><|sor|>No, it obviously doesn't, shown by this example. How can `'z' + 1 < 'z'` be true?
The result of the addition is definitely wrong. The comparison logic is ok (can lead to subtle errors, but acceptable for a loosely typed language). <|eor|><|eols|><|endoftext|> | 13 |
lolphp | Schmittfried | cy257x5 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Excel column naming.
Also, it fits with the usual comparison rules for strings.<|eor|><|sor|>No, it obviously doesn't, shown by this example. How can `'z' + 1 < 'z'` be true?
The result of the addition is definitely wrong. The comparison logic is ok (can lead to subtle errors, but acceptable for a loosely typed language). <|eor|><|sor|>> How can 'z' + 1 < 'z' be true?
Oh, right, yes, I forgot that it doesn't match string sorting, forget I said that.
Also, it's not `'z' + 1`, it only happens for `++` (yes, it's awful).<|eor|><|sor|>>Also, it's not 'z' + 1, it only happens for ++ (yes, it's awful).
Ah ok. Even more wtf.<|eor|><|eols|><|endoftext|> | 13 |
lolphp | ismtrn | cy21w70 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>In many languages you can do computations with characters, because they are just numbers interpreted as characters. Perfectly fine. The stupid thing is that PHP seems to do computations on actual strings, i.e. even on multiple characters resulting in strange semantics like `'z' + 1 == 'aa' `. It should be whatever is following 'z' in the ASCII charset, which is how every sane language does it.<|eor|><|sor|>C can use different chatacter sets depending on the platform so you are not guaranteed to get the next ASCII char if you want to be cross platform.
You are not even guaranteed to be able to loop through the alphabet by incrementing if the character set is strange enough.<|eor|><|eols|><|endoftext|> | 12 |
lolphp | the_alias_of_andrea | cy1yti9 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Excel column naming.
Also, it fits with the usual comparison rules for strings.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | Schmittfried | cy21mt8 | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Yeah. I can totally accept that `'aa' < 'z'`, that part is okay. But how could you possibly think that `'z'++` should be `'aa'`? What the fuck?<|eor|><|sor|>How could you think that incrementing a string is a good idea or that it would give sensible results?<|eor|><|sor|>In many languages you can do computations with characters, because they are just numbers interpreted as characters. Perfectly fine. The stupid thing is that PHP seems to do computations on actual strings, i.e. even on multiple characters resulting in strange semantics like `'z' + 1 == 'aa' `. It should be whatever is following 'z' in the ASCII charset, which is how every sane language does it.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | the_alias_of_andrea | cy24x1e | <|sols|><|sot|>Iterating through all 676 letters in the alphabet<|eot|><|sol|>https://secure.phabricator.com/book/phabflavor/article/php_pitfalls/#all-676-letters-in-the-a<|eol|><|sor|>>the successor to `z` is `aa`
...I'm sorry; what?<|eor|><|sor|>Excel column naming.
Also, it fits with the usual comparison rules for strings.<|eor|><|sor|>No, it obviously doesn't, shown by this example. How can `'z' + 1 < 'z'` be true?
The result of the addition is definitely wrong. The comparison logic is ok (can lead to subtle errors, but acceptable for a loosely typed language). <|eor|><|sor|>> How can 'z' + 1 < 'z' be true?
Oh, right, yes, I forgot that it doesn't match string sorting, forget I said that.
Also, it's not `'z' + 1`, it only happens for `++` (yes, it's awful).<|eor|><|eols|><|endoftext|> | 10 |
lolphp | elsjaako | wmrbqh | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|eols|><|endoftext|> | 110 |
lolphp | barubary | ik18c6h | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>Well, gender is just a construct:
> * Gender\Gender::\_\_construct Construct the Gender object
If you don't like the ones already out there, just create your own:
$what = new Gender; // based
---
At least we now know what the superior gender is:
Gender::IS_MALE > Gender::IS_FEMALE
(In fact, the difference between `Gender::IS_MALE` and `Gender::IS_FEMALE` is exactly 7.)
And I wasn't aware that couples had their own gender: `Gender::IS_A_COUPLE` is a thing, apparently.
---
However, it is not always clear what failure means since `Gender::NAME_NOT_FOUND === Gender::KOSOVO`:
> const int NAME_NOT_FOUND = 32;
> // ...
> const int KOSOVO = 32;
---
And maybe we can find failure in success [or vice versa](https://www.php.net/manual/en/gender-gender.connect.php):
> Boolean as success of failure.
---
What is the type of a "textual representation"? [That's right](https://www.php.net/manual/en/gender-gender.country.php), it's `array|false`.
> public Gender\Gender::country(int $country): array|false
> Returns **the textual representation** of a country from a Gender class constant.
(I'm sure there's a good reason why this is an object method and not `static`. Unfortunately the manual doesn't say what that reason is.)
---
But who knows? Maybe `array` is simply the natural type [for all kinds of data](https://www.php.net/manual/en/gender-gender.isnick.php):
> public Gender\Gender::isNick(string $name0, string $name1, int $country = ?): array
> Returns **true** on success or **false** on failure.
---
The list of countries contains a few anomalies as well:
- There is `Gender::GERMANY` and `Gender::AUSTRIA`, but no `Gender::SWITZERLAND`. There is, however, `Gender::SWISS`.
- There is no `Gender::UNITED_KINGDOM`, only `Gender::BRITAIN`. Sorry, Isle of Wight, Orkney, Anglesey, etc.; you don't get to have genders.<|eor|><|eols|><|endoftext|> | 73 |
lolphp | barubary | ik1ccn4 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|sor|>It's a pretty wacky port.
- It turns the plain C code into a class (for some reason).
- The class is named `Gender` even though its instances do not represent genders.
- The free-standing constants of the C code are placed inside the class (for some reason), i.e. instead of `GC_SPAIN` we get `Gender::SPAIN`.
- The gender constants, which are characters in the C version (`F` for female, `M` for male, `f` for mostly female, etc.), have become integers in PHP.
- The gender and country/region constants have been placed in the same list. They're not even distinguishable by a naming scheme or convention. The programmer simply has to know that `Gender::NAME_NOT_FOUND` (32) is a gender constant and `Gender::EAST_FRISIA` (13) is a country constant.
- When I say "the programmer simply has to know", I mean it. This stuff isn't even documented (let alone what the difference between `Gender::IS_UNISEX_NAME` and `Gender::IS_A_COUPLE` is).
> who is German, hence the `EAST_FRISIA` constant
Non sequitur. Why does [East Frisia](https://en.wikipedia.org/wiki/East_Frisia), out of all German regions, get its own country code?<|eor|><|eols|><|endoftext|> | 35 |
lolphp | SeesawMundane5422 | ik27rtd | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>Please refer to me by my new preferred pronoun: Italy.<|eor|><|eols|><|endoftext|> | 17 |
lolphp | alficles | ik3nmrt | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|sor|>It's a pretty wacky port.
- It turns the plain C code into a class (for some reason).
- The class is named `Gender` even though its instances do not represent genders.
- The free-standing constants of the C code are placed inside the class (for some reason), i.e. instead of `GC_SPAIN` we get `Gender::SPAIN`.
- The gender constants, which are characters in the C version (`F` for female, `M` for male, `f` for mostly female, etc.), have become integers in PHP.
- The gender and country/region constants have been placed in the same list. They're not even distinguishable by a naming scheme or convention. The programmer simply has to know that `Gender::NAME_NOT_FOUND` (32) is a gender constant and `Gender::EAST_FRISIA` (13) is a country constant.
- When I say "the programmer simply has to know", I mean it. This stuff isn't even documented (let alone what the difference between `Gender::IS_UNISEX_NAME` and `Gender::IS_A_COUPLE` is).
> who is German, hence the `EAST_FRISIA` constant
Non sequitur. Why does [East Frisia](https://en.wikipedia.org/wiki/East_Frisia), out of all German regions, get its own country code?<|eor|><|sor|>/r/genderswithoutnewzealand<|eor|><|eols|><|endoftext|> | 13 |
lolphp | pokexpert30 | ik3wkdg | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>Well, gender is just a construct:
> * Gender\Gender::\_\_construct Construct the Gender object
If you don't like the ones already out there, just create your own:
$what = new Gender; // based
---
At least we now know what the superior gender is:
Gender::IS_MALE > Gender::IS_FEMALE
(In fact, the difference between `Gender::IS_MALE` and `Gender::IS_FEMALE` is exactly 7.)
And I wasn't aware that couples had their own gender: `Gender::IS_A_COUPLE` is a thing, apparently.
---
However, it is not always clear what failure means since `Gender::NAME_NOT_FOUND === Gender::KOSOVO`:
> const int NAME_NOT_FOUND = 32;
> // ...
> const int KOSOVO = 32;
---
And maybe we can find failure in success [or vice versa](https://www.php.net/manual/en/gender-gender.connect.php):
> Boolean as success of failure.
---
What is the type of a "textual representation"? [That's right](https://www.php.net/manual/en/gender-gender.country.php), it's `array|false`.
> public Gender\Gender::country(int $country): array|false
> Returns **the textual representation** of a country from a Gender class constant.
(I'm sure there's a good reason why this is an object method and not `static`. Unfortunately the manual doesn't say what that reason is.)
---
But who knows? Maybe `array` is simply the natural type [for all kinds of data](https://www.php.net/manual/en/gender-gender.isnick.php):
> public Gender\Gender::isNick(string $name0, string $name1, int $country = ?): array
> Returns **true** on success or **false** on failure.
---
The list of countries contains a few anomalies as well:
- There is `Gender::GERMANY` and `Gender::AUSTRIA`, but no `Gender::SWITZERLAND`. There is, however, `Gender::SWISS`.
- There is no `Gender::UNITED_KINGDOM`, only `Gender::BRITAIN`. Sorry, Isle of Wight, Orkney, Anglesey, etc.; you don't get to have genders.<|eor|><|sor|>Holy fucking shit. That is the most lolphp comment ever.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | barubary | ik3yyo6 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>How is language processing a LOL?<|eor|><|sor|> publiccountry(int$country):array|false
So... you read this line and think "yeah, that makes sense"?<|eor|><|sor|>Do you even use PHP? [RTFM](https://www.php.net/manual/en/gender-gender.country.php), the integers are the class constants.<|eor|><|sor|>You mean like this?
$femboy = new Gender\Gender;
var_dump( $femboy->country(-1) );
var_dump( $femboy->country(-2) );
var_dump( $femboy->country(12345) );
var_dump( $femboy->country(Gender\Gender::NAME_NOT_FOUND) );
You've read TFM. What does this code output?
---
I'm pretty sure the answer is along the following lines:
[ 'country_short' => 'XX', 'country' => 'other countries' ]
[]
[]
[ 'country_short' => 'KOS', 'country' => 'Kosovo' ]
Does this strike you as sensible?
---
Finally, why isn't `country()` a class method? The list of country constants is static; why do we need to instantiate an object to get their names?<|eor|><|eols|><|endoftext|> | 11 |
lolphp | elsjaako | ik9je85 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|soopr|>I find it funny that it seems to be listed as a gender (same list as "IS_MALE").
I understand the reason, but even then having such a german-centric function built into your standard library is weird. Hence LOLPHP.<|eoopr|><|sor|>This is not part of PHP's standard library. It's a userland extension last updated in 2015. It's not bundled with PHP. No one uses PECL anymore.<|eor|><|soopr|>Thanks, learned something.
It somehow mystifies me even more though.
Why is it listed in the PHP manual if it's not part of the standard library? Even more so if the whole technology (PECL) isn't even used anymore?
Why is there a comment in the description saying that it doesn't actually compile with modern PHP? Wouldn't that also be a reason to remove it from the manual?
https://www.php.net/manual/en/gender.installation.php<|eoopr|><|eols|><|endoftext|> | 9 |
lolphp | m1ss1ontomars2k4 | ik2bbgx | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|sor|>It's a pretty wacky port.
- It turns the plain C code into a class (for some reason).
- The class is named `Gender` even though its instances do not represent genders.
- The free-standing constants of the C code are placed inside the class (for some reason), i.e. instead of `GC_SPAIN` we get `Gender::SPAIN`.
- The gender constants, which are characters in the C version (`F` for female, `M` for male, `f` for mostly female, etc.), have become integers in PHP.
- The gender and country/region constants have been placed in the same list. They're not even distinguishable by a naming scheme or convention. The programmer simply has to know that `Gender::NAME_NOT_FOUND` (32) is a gender constant and `Gender::EAST_FRISIA` (13) is a country constant.
- When I say "the programmer simply has to know", I mean it. This stuff isn't even documented (let alone what the difference between `Gender::IS_UNISEX_NAME` and `Gender::IS_A_COUPLE` is).
> who is German, hence the `EAST_FRISIA` constant
Non sequitur. Why does [East Frisia](https://en.wikipedia.org/wiki/East_Frisia), out of all German regions, get its own country code?<|eor|><|sor|>The local language apparently creates unique first names not common elsewhere in Germany:
https://en.wikipedia.org/wiki/East_Frisian_Low_Saxon
The examples from this article (Trintje and Antje) are both present in the list of names. I believe the implication of the person you are responding to is that only a German would even have the knowledge to know that East Frisia would have different names from the rest of Germany, let alone care enough to include them as separate from Germany.
ISTM this library is designed for people familiar with the C library and is just a thin wrapper on top of that. The name of the class doesn't mean its contents are genders; it means its contents come from `gender.c` and they are all the constants from that C library.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | alficles | ik3wd2s | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|sor|>It's a pretty wacky port.
- It turns the plain C code into a class (for some reason).
- The class is named `Gender` even though its instances do not represent genders.
- The free-standing constants of the C code are placed inside the class (for some reason), i.e. instead of `GC_SPAIN` we get `Gender::SPAIN`.
- The gender constants, which are characters in the C version (`F` for female, `M` for male, `f` for mostly female, etc.), have become integers in PHP.
- The gender and country/region constants have been placed in the same list. They're not even distinguishable by a naming scheme or convention. The programmer simply has to know that `Gender::NAME_NOT_FOUND` (32) is a gender constant and `Gender::EAST_FRISIA` (13) is a country constant.
- When I say "the programmer simply has to know", I mean it. This stuff isn't even documented (let alone what the difference between `Gender::IS_UNISEX_NAME` and `Gender::IS_A_COUPLE` is).
> who is German, hence the `EAST_FRISIA` constant
Non sequitur. Why does [East Frisia](https://en.wikipedia.org/wiki/East_Frisia), out of all German regions, get its own country code?<|eor|><|sor|>/r/genderswithoutnewzealand<|eor|><|sor|>The subreddit r/genderswithoutnewzealand does not exist.
Did you mean?:
* r/mapswithoutnewzealand (subscribers: 13,928)
Consider [**creating a new subreddit** r/genderswithoutnewzealand](/subreddits/create?name=genderswithoutnewzealand).
---
^( this comment was written by a bot. beep boop )
^(feel welcome to respond 'Bad bot'/'Good bot', it's useful feedback.)
^[github](https://github.com/Toldry/RedditAutoCrosspostBot) ^| ^[Rank](https://botranks.com?bot=sub_doesnt_exist_bot)<|eor|><|sor|>Thanks, bot, you got the joke. :D<|eor|><|eols|><|endoftext|> | 7 |
lolphp | barubary | ik48huw | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>How is language processing a LOL?<|eor|><|sor|> publiccountry(int$country):array|false
So... you read this line and think "yeah, that makes sense"?<|eor|><|sor|>Do you even use PHP? [RTFM](https://www.php.net/manual/en/gender-gender.country.php), the integers are the class constants.<|eor|><|sor|>You mean like this?
$femboy = new Gender\Gender;
var_dump( $femboy->country(-1) );
var_dump( $femboy->country(-2) );
var_dump( $femboy->country(12345) );
var_dump( $femboy->country(Gender\Gender::NAME_NOT_FOUND) );
You've read TFM. What does this code output?
---
I'm pretty sure the answer is along the following lines:
[ 'country_short' => 'XX', 'country' => 'other countries' ]
[]
[]
[ 'country_short' => 'KOS', 'country' => 'Kosovo' ]
Does this strike you as sensible?
---
Finally, why isn't `country()` a class method? The list of country constants is static; why do we need to instantiate an object to get their names?<|eor|><|sor|>Another person who doesn't actually work in PHP and can't RTFM. Why would you pass random integer literals to a method that's intended to accept the integers from the class constants? Because, you know, surprise surprise, it's a class wrapper over a library for parsing language, and they are the countries it knows about. That's equivalent to complaining about not being able to use any arbitrary undefined constant. News flash, that's not how constants work. Me trying to use `PDO::PARAM_PARACHUTE`, amazingly enough, doesn't magically inform the underlying libraries about how to store a parachute data-type in a database. The class isn't for creating your own genders.
You're an absolute fucking moron and I hope no one is paying you to do anything more advanced than tweak WordPress themes.<|eor|><|sor|>> Why would you pass random integer literals to a method that's intended to accept the integers from the class constants?
To check whether the method actually behaves as documented and returns `false` on error. (Also, `Gender::NAME_NOT_FOUND` is a class constant.)<|eor|><|eols|><|endoftext|> | 7 |
lolphp | lolpls | ik12yo4 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Sarcastinator | ik3ggqa | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>How is language processing a LOL?<|eor|><|sor|> publiccountry(int$country):array|false
So... you read this line and think "yeah, that makes sense"?<|eor|><|eols|><|endoftext|> | 5 |
lolphp | barubary | ik2fzv6 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>And?
This is a PECL extension, namely the port of `gender.c` by Jrg MICHAEL, who is German, hence the `EAST_FRISIA` constant.
About: https://www.php.net/manual/en/book.gender.php
Original: https://www.heise.de/ct/ftp/07/17/182/<|eor|><|sor|>It's a pretty wacky port.
- It turns the plain C code into a class (for some reason).
- The class is named `Gender` even though its instances do not represent genders.
- The free-standing constants of the C code are placed inside the class (for some reason), i.e. instead of `GC_SPAIN` we get `Gender::SPAIN`.
- The gender constants, which are characters in the C version (`F` for female, `M` for male, `f` for mostly female, etc.), have become integers in PHP.
- The gender and country/region constants have been placed in the same list. They're not even distinguishable by a naming scheme or convention. The programmer simply has to know that `Gender::NAME_NOT_FOUND` (32) is a gender constant and `Gender::EAST_FRISIA` (13) is a country constant.
- When I say "the programmer simply has to know", I mean it. This stuff isn't even documented (let alone what the difference between `Gender::IS_UNISEX_NAME` and `Gender::IS_A_COUPLE` is).
> who is German, hence the `EAST_FRISIA` constant
Non sequitur. Why does [East Frisia](https://en.wikipedia.org/wiki/East_Frisia), out of all German regions, get its own country code?<|eor|><|sor|>The local language apparently creates unique first names not common elsewhere in Germany:
https://en.wikipedia.org/wiki/East_Frisian_Low_Saxon
The examples from this article (Trintje and Antje) are both present in the list of names. I believe the implication of the person you are responding to is that only a German would even have the knowledge to know that East Frisia would have different names from the rest of Germany, let alone care enough to include them as separate from Germany.
ISTM this library is designed for people familiar with the C library and is just a thin wrapper on top of that. The name of the class doesn't mean its contents are genders; it means its contents come from `gender.c` and they are all the constants from that C library.<|eor|><|sor|>> I believe the implication of the person you are responding to is that only a German would even have the knowledge to know that East Frisia would have different names from the rest of Germany, let alone care enough to include them as separate from Germany.
I'd say this only makes sense if in this region the names are assigned a different gender than in the rest of Germany, but it doesn't look like that's the case. For example, "Antje" is commonly used as a female name elsewhere in Germany and the Netherlands.
Besides, there must be many other regions with fairly unique names that don't get their own code. For example, Wra and Korla are Sorbian names that are not commonly found in other parts of Germany.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | Sarcastinator | ik47pm3 | <|sols|><|sot|>PHP Gender constants. Is your gender EAST_FRISIA?<|eot|><|sol|>https://www.php.net/manual/en/class.gender.php<|eol|><|sor|>How is language processing a LOL?<|eor|><|sor|> publiccountry(int$country):array|false
So... you read this line and think "yeah, that makes sense"?<|eor|><|sor|>Do you even use PHP? [RTFM](https://www.php.net/manual/en/gender-gender.country.php), the integers are the class constants.<|eor|><|sor|>I meant a function named country takes an argument also named country which is an integer and returns an array...of something.
The integer constants are all jumbled together. This API is very badly designed with complete disregard for consistency or even sanity.<|eor|><|sor|>Because people couldn't possibly want more than a single, scalar piece of data associated with a particular constant? Never said it was a beautiful interface, but if you're having trouble dealing with small arrays, I pity you.<|eor|><|sor|>There is a saying about interfaces: if you need to explain it it's not very good.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | 1bc29b | 4jwm6o | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|eoss|><|endoftext|> | 107 |
lolphp | ismtrn | d3a8jxc | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Seems like that would be a problem to solve.<|eor|><|sor|>Normal people see restarting Apache every 10 requests as a problem. PHP developers see it as a solution.<|eor|><|eoss|><|endoftext|> | 62 |
lolphp | beerdude26 | d3aexw4 | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>What a massively shitty and cocky article. If people like these get to choose the direction of the future of programming, you'll need several gigs of RAM and a sixteen core top-of-the-line Xeon chugging away for 500ms just to send a HTTP response that says "Hello World".<|eor|><|eoss|><|endoftext|> | 44 |
lolphp | greyfade | d3af9au | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>What a massively shitty and cocky article. If people like these get to choose the direction of the future of programming, you'll need several gigs of RAM and a sixteen core top-of-the-line Xeon chugging away for 500ms just to send a HTTP response that says "Hello World".<|eor|><|sor|>That's why Facebook saved so much money switching to their HipHop compiler. It cut their hardware needs by an order of magnitude.<|eor|><|eoss|><|endoftext|> | 30 |
lolphp | ciawal | d3a6ioj | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Seems like that would be a problem to solve.<|eor|><|eoss|><|endoftext|> | 28 |
lolphp | Fitzsimmons | d3amcww | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Seems like that would be a problem to solve.<|eor|><|sor|>Normal people see restarting Apache every 10 requests as a problem. PHP developers see it as a solution.<|eor|><|sor|>I don't think he really meant to say to restart Apache, but rather, restart PHP under Apache, after handling a number of requests.<|eor|><|sor|>it's now a feature of php-fpm<|eor|><|sor|>genuinely can't tell if serious or joke<|eor|><|eoss|><|endoftext|> | 20 |
lolphp | thatmarksguy | d3ajby2 | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>The cancer of the industry.<|eor|><|eoss|><|endoftext|> | 18 |
lolphp | beerdude26 | d3agimz | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>What a massively shitty and cocky article. If people like these get to choose the direction of the future of programming, you'll need several gigs of RAM and a sixteen core top-of-the-line Xeon chugging away for 500ms just to send a HTTP response that says "Hello World".<|eor|><|sor|>That's why Facebook saved so much money switching to their HipHop compiler. It cut their hardware needs by an order of magnitude.<|eor|><|sor|>Similar for their anti-spam system, after switching to Haskell they got a 50%+ performance boost.<|eor|><|eoss|><|endoftext|> | 16 |
lolphp | 1bc29b | d3afsu3 | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>What a massively shitty and cocky article. If people like these get to choose the direction of the future of programming, you'll need several gigs of RAM and a sixteen core top-of-the-line Xeon chugging away for 500ms just to send a HTTP response that says "Hello World".<|eor|><|soopr|>And have it restart Apache every few minutes.<|eoopr|><|eoss|><|endoftext|> | 11 |
lolphp | CosineTau | d3am6r1 | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Well, that answers a lot of questions.<|eor|><|eoss|><|endoftext|> | 9 |
lolphp | bart2019 | d3bbt9e | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>it's an old quote, but is pretty telling
I've actually seen people do that in production<|eor|><|sor|>What, exactly, were they producing? I can't imagine it was anything of any real value.<|eor|><|sor|>A website.<|eor|><|eoss|><|endoftext|> | 8 |
lolphp | captain_obvious_here | d3bcinv | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>it's an old quote, but is pretty telling
I've actually seen people do that in production<|eor|><|sor|>What, exactly, were they producing? I can't imagine it was anything of any real value.<|eor|><|sor|>A website.<|eor|><|sor|>Wait, you can do that with PHP ?!<|eor|><|eoss|><|endoftext|> | 7 |
lolphp | cjwelborn | d3bsxpj | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Someone has compiled a list of quotes like this at [https://en.wikiquote.org/wiki/Rasmus_Lerdorf](https://en.wikiquote.org/wiki/Rasmus_Lerdorf). They link to the source.<|eor|><|eoss|><|endoftext|> | 6 |
lolphp | bart2019 | d3acrzv | <|soss|><|sot|>Rasmus Lerdorf: The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eot|><|sost|>From : https://medium.com/@WordcorpGlobal/programming-doesnt-require-talent-or-even-passion-11422270e1e4#.mb0azok7p
> * I actually hate programming, but I love solving problems.
* There are people who actually like programming. I dont understand why they like programming.
* Im not a real programmer. I throw together things until it works then I move on. The real programmers will say Yeah it works but youre leaking memory everywhere. Perhaps we should fix that. Ill just restart Apache every 10 requests.<|eost|><|sor|>Seems like that would be a problem to solve.<|eor|><|sor|>Normal people see restarting Apache every 10 requests as a problem. PHP developers see it as a solution.<|eor|><|sor|>I don't think he really meant to say to restart Apache, but rather, restart PHP under Apache, after handling a number of requests.<|eor|><|eoss|><|endoftext|> | 5 |
lolphp | the_alias_of_andrea | 42gxxd | <|sols|><|sot|>"" 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<|eot|><|sol|>https://3v4l.org/Tg6GB<|eol|><|eols|><|endoftext|> | 107 |
lolphp | the_alias_of_andrea | cza7ent | <|sols|><|sot|>"" 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<|eot|><|sol|>https://3v4l.org/Tg6GB<|eol|><|soopr|>The reason for decoding the JSON key `""` to `"_empty_"` is that, for no apparent good reason, you can't have empty strings as property names on an object. Try to create one, you get an error. Try to access one, you get an error. Except... well, if you cast from an array, there's no check for invalid names. So you actually *can* create one. And `serialize` will happily serialize an object with an empty property name, but when it goes to unserialize it, it all breaks. Also, JSON despite *decoding* `""` to `"_empty_"`, it doesn't work the other way round, because screw you.
PHP is so awful sometimes.
Luckily, though, I think this could be fixed pretty easily. I'll write a patch.<|eoopr|><|eols|><|endoftext|> | 61 |
lolphp | nikic | czaiau6 | <|sols|><|sot|>"" 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<|eot|><|sol|>https://3v4l.org/Tg6GB<|eol|><|soopr|>The reason for decoding the JSON key `""` to `"_empty_"` is that, for no apparent good reason, you can't have empty strings as property names on an object. Try to create one, you get an error. Try to access one, you get an error. Except... well, if you cast from an array, there's no check for invalid names. So you actually *can* create one. And `serialize` will happily serialize an object with an empty property name, but when it goes to unserialize it, it all breaks. Also, JSON despite *decoding* `""` to `"_empty_"`, it doesn't work the other way round, because screw you.
PHP is so awful sometimes.
Luckily, though, I think this could be fixed pretty easily. I'll write a patch.<|eoopr|><|sor|>If you change this, you should probably also remove the notices from property name unmangling -- I suspect that this is the original motivation behind forbidding empty property names.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | polish_niceguy | czbfb08 | <|sols|><|sot|>"" 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<|eot|><|sol|>https://3v4l.org/Tg6GB<|eol|><|soopr|>The reason for decoding the JSON key `""` to `"_empty_"` is that, for no apparent good reason, you can't have empty strings as property names on an object. Try to create one, you get an error. Try to access one, you get an error. Except... well, if you cast from an array, there's no check for invalid names. So you actually *can* create one. And `serialize` will happily serialize an object with an empty property name, but when it goes to unserialize it, it all breaks. Also, JSON despite *decoding* `""` to `"_empty_"`, it doesn't work the other way round, because screw you.
PHP is so awful sometimes.
Luckily, though, I think this could be fixed pretty easily. I'll write a patch.<|eoopr|><|sor|>*Patch rejected, breaks backwards compatibility.*<|eor|><|eols|><|endoftext|> | 14 |
lolphp | djxfade | 8ii4y5 | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|eols|><|endoftext|> | 104 |
lolphp | girst | dys1qq3 | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>>While there is a **`sleep()`** to prevent multiple duplicate IDs in the same process, []
Oh wow. <|eor|><|eols|><|endoftext|> | 69 |
lolphp | aleczapka | dys29ac | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|> real_uniqid()<|eor|><|eols|><|endoftext|> | 63 |
lolphp | redfacedquark | dyt2vtd | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>I don't understand why the solution isn't to make sure that it does return a unique id?<|eor|><|sor|>You mean fix it? What would happen to this sub?<|eor|><|eols|><|endoftext|> | 30 |
lolphp | vekien | dyuz6qf | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|> real_uniqid()<|eor|><|sor|> real_honest_on_me_mums_life_uniqid()<|eor|><|eols|><|endoftext|> | 26 |
lolphp | amazingmikeyc | dyt1u3b | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>I don't understand why the solution isn't to make sure that it does return a unique id?<|eor|><|eols|><|endoftext|> | 24 |
lolphp | cleeder | dytmjrp | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>I don't understand why the solution isn't to make sure that it does return a unique id?<|eor|><|sor|>You mean fix it? What would happen to this sub?<|eor|><|sor|>Something like this can't just be "fixed", unfortunately. A method like this hinges entirely or forward and backwards trust. If one of those is compromised, then the method itself is compromised and can't be trusted.
Without changing the format of the return value, there is no way to ensure that values issued under the "fixed" method don't collide with previously issued values which also utilized the entire address space. This diminishes the trust of this method further.
If the format or address space of the new values _does_ change, then it makes no sense to issue them from this method which is already in use in the wild and returns a value from in an expected format from an expected value space.<|eor|><|eols|><|endoftext|> | 15 |
lolphp | rinyre | dysekmt | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>https://xkcd.com/221/<|eor|><|eols|><|endoftext|> | 14 |
lolphp | pingpong | dysht41 | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>https://xkcd.com/221/<|eor|><|sor|>http://dilbert.com/strip/2001-10-25<|eor|><|eols|><|endoftext|> | 11 |
lolphp | VID44R | dzw761w | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|> real_uniqid()<|eor|><|sor|> return 4; //generated by fair dice roll<|eor|><|eols|><|endoftext|> | 8 |
lolphp | Various_Pickles | e03y1oj | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|> real_uniqid()<|eor|><|sor|>The result will be encoded in the mysql_lol_kinda_utf8 charset.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Dgc2002 | dyteju7 | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>I don't understand why the solution isn't to make sure that it does return a unique id?<|eor|><|sor|>My assumption is backward compatibility. Deprecating something is better than changing it's behavior. The former requires the usage code to be updated(once it's actually deprecated) while the other could silently break some obscure program that relies on the current behavior.
Edit: Here's another [discussion about it](https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/dyrs5mj/)<|eor|><|sor|>This is a bug, it is a reasonably recently discovered bug that completely undermines the purpose of the function. Moreover, actually using this broken behavior would be completely stupid.
So this change won't break existing code, or if it does the existing code then the person whose code is broken by the uniqid function actually returning a unique ID deserves to have their code broken.<|eor|><|sor|>It doesn't matter if it's a bug or not. The fact of the matter is that there are likely applications that, even unknowingly, rely on the broken behavior.
> So this change won't break existing code, or if it does the existing code then the person whose code is broken by the uniqid function actually returning a unique ID deserves to have their code broken.
But, for better or worse, that's not how BC breaks are treated in PHP. I'm not here to discuss what we all think would be the ideal way to handle this. I'm talking about how it's actually being handled.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | Dgc2002 | dyt5h50 | <|sols|><|sot|>uniqid() to be deprecated becase it doesn't actually return a unique id<|eot|><|sol|>https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/<|eol|><|sor|>I don't understand why the solution isn't to make sure that it does return a unique id?<|eor|><|sor|>My assumption is backward compatibility. Deprecating something is better than changing it's behavior. The former requires the usage code to be updated(once it's actually deprecated) while the other could silently break some obscure program that relies on the current behavior.
Edit: Here's another [discussion about it](https://www.reddit.com/r/PHP/comments/8ihefw/php_rfc_deprecate_uniqid/dyrs5mj/)<|eor|><|eols|><|endoftext|> | 5 |
lolphp | GestinkoGestapo | 48sfzj | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|eols|><|endoftext|> | 107 |
lolphp | Regimardyl | d0mcsi6 | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>Pick your poison:
Language | Effect
:-- | :--
Tcl | There is no null
Lua | Type error
Python 3 | Type error
Python 2 | `None` is smaller than everything
Javascript | `null` gets coerced to 0
Ruby | `<` is not implemented for `nil`, so you have to put the number first. Then throws an `ArgumentError`
Perl | `null` gets coerced to 0<|eor|><|eols|><|endoftext|> | 44 |
lolphp | serendependy | d0mf7hy | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>An error...<|eor|><|eols|><|endoftext|> | 24 |
lolphp | coredumperror | d0m68i2 | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Isn't this just a consequence of type coercion?
In PHP:
null == 0 //Evaluates to true
null === 0 //Evaluates to false
I would imagine that null is treated as 0 when comparing numbers, which is why you need to also compare type using the '===' operator if you want to actually compare it to zero.
Intuitively it feels pretty stupid, but it's not the dumbest thing on offer in PHP :P<|eor|><|sor|>> Isn't this just a consequence of type coercion?
Nope, because as the linked page shows,
var_dump(null < -5);
prints bool(true). I certainly hope var_dump(0 < -5) doesn't do that.<|eor|><|eols|><|endoftext|> | 24 |
lolphp | flowblok | d0mqptg | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>Pick your poison:
Language | Effect
:-- | :--
Tcl | There is no null
Lua | Type error
Python 3 | Type error
Python 2 | `None` is smaller than everything
Javascript | `null` gets coerced to 0
Ruby | `<` is not implemented for `nil`, so you have to put the number first. Then throws an `ArgumentError`
Perl | `null` gets coerced to 0<|eor|><|sor|>SQL: NULL semantically means an unknown value, and therefore since it isn't known, all* comparisons against other values are also unknown (and so the result is NULL).
* except operations where the answer is logically known, e.g. NULL OR TRUE = TRUE
To answer prewk: I don't care which position a language takes, as long as it has consistent semantic sense: so errors, being smaller than everything, and SQL's "unknown value" semantics are all things I'm happy with.<|eor|><|eols|><|endoftext|> | 24 |
lolphp | prewk | d0mc37y | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|eols|><|endoftext|> | 23 |
lolphp | vita10gy | d0mh7nr | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>An error...<|eor|><|sor|>But php decided errors are the devil, so given that, it has to do something, and there's not always a great answer for garbage in garbage out situations.
I guess I don't know why it isn't just zero though.
It's one of the many things where languages that make it "easier" for people are always harder in the end. <|eor|><|eols|><|endoftext|> | 16 |
lolphp | coredumperror | d0mhkll | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>An error...<|eor|><|sor|>Honestly, in a weakly-typed language, I *wouldn't* expect an error here. I'd expect NULL to be coerced to zero. But that's not what PHP is doing, since NULL < -5 == true.<|eor|><|eols|><|endoftext|> | 16 |
lolphp | kinsi55 | d0mc6pj | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>My guess is it parses all the stuff as booleans. Comparing them further handles them as integers. Since 1 is greater than 0, everything is true.
Yada yada:
~> cat test.php
<?php
print ((int)(bool)null)."\n";
print ((int)(bool)2)."\n";
print ((int)(bool)-5)."\n";
print ((int)(bool)(double)"-5e10")."\n";
print ((int)(bool)(double)"5e10")."\n";
print ((int)(bool)-INF)."\n";
print ((int)(bool)INF)."\n";
print ((int)(bool)(double)0)."\n";
print ((int)(bool)0)."\n";
?>
~> php test.php
0
1
1
1
1
1
1
0
0<|eor|><|eols|><|endoftext|> | 15 |
lolphp | killerstorm | d0mnfsi | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>Pick your poison:
Language | Effect
:-- | :--
Tcl | There is no null
Lua | Type error
Python 3 | Type error
Python 2 | `None` is smaller than everything
Javascript | `null` gets coerced to 0
Ruby | `<` is not implemented for `nil`, so you have to put the number first. Then throws an `ArgumentError`
Perl | `null` gets coerced to 0<|eor|><|sor|>SQL: (1 < NULL) is NULL<|eor|><|eols|><|endoftext|> | 9 |
lolphp | prewk | d0n86n4 | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>Pick your poison:
Language | Effect
:-- | :--
Tcl | There is no null
Lua | Type error
Python 3 | Type error
Python 2 | `None` is smaller than everything
Javascript | `null` gets coerced to 0
Ruby | `<` is not implemented for `nil`, so you have to put the number first. Then throws an `ArgumentError`
Perl | `null` gets coerced to 0<|eor|><|sor|>SQL: NULL semantically means an unknown value, and therefore since it isn't known, all* comparisons against other values are also unknown (and so the result is NULL).
* except operations where the answer is logically known, e.g. NULL OR TRUE = TRUE
To answer prewk: I don't care which position a language takes, as long as it has consistent semantic sense: so errors, being smaller than everything, and SQL's "unknown value" semantics are all things I'm happy with.<|eor|><|sor|>Sounds reasonable. But my point is: don't try to make decisions depending on how large a null is.<|eor|><|eols|><|endoftext|> | 8 |
lolphp | InconsiderateBastard | d0n70ke | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Isn't this just a consequence of type coercion?
In PHP:
null == 0 //Evaluates to true
null === 0 //Evaluates to false
I would imagine that null is treated as 0 when comparing numbers, which is why you need to also compare type using the '===' operator if you want to actually compare it to zero.
Intuitively it feels pretty stupid, but it's not the dumbest thing on offer in PHP :P<|eor|><|sor|>If you run the same code replacing null with 0 you get a completely different set of answers... so whatever is happening, it isn't that straightforward.<|eor|><|sor|>[removed]<|eor|><|sor|>Thankfully the inconsistencies are frequently documented. It's like having a helpful guide leading you through hell.<|eor|><|eols|><|endoftext|> | 7 |
lolphp | DoctorWaluigiTime | d0mfgph | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Like always with these type coercion lolphp posts, I've got to ask: How large do you, yourself, think that `null` is? Is it smaller than zero? Larger? What would be your preferred non-lolphp result?<|eor|><|sor|>An error, as another user said. Makes me glad I work in a strongly-typed language.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | powatom | d0m57ms | <|sols|><|sot|>null is apparently smaller than any number you can imagine. Except zero.<|eot|><|sol|>https://3v4l.org/MVDH0<|eol|><|sor|>Isn't this just a consequence of type coercion?
In PHP:
null == 0 //Evaluates to true
null === 0 //Evaluates to false
I would imagine that null is treated as 0 when comparing numbers, which is why you need to also compare type using the '===' operator if you want to actually compare it to zero.
Intuitively it feels pretty stupid, but it's not the dumbest thing on offer in PHP :P<|eor|><|eols|><|endoftext|> | 5 |
lolphp | ealf | 1ddlpp | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|eols|><|endoftext|> | 103 |
lolphp | dafragsta | c9pa4xs | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|sor|>I can't believe more people don't run into that.<|eor|><|eols|><|endoftext|> | 11 |
lolphp | movzx | c9q3dpj | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|sor|>As someone who uses PHP for tons of little hacky scripts at work ("When all you have is a hammer, every problem looks like a nail", but hey, it gets the job done quickly), this does not surprise me even a little bit.
Take str_replace and strpos, for example:
str_replace uses an underscore in its name, uses the search argument first and subject being searched last (with the replace value in between).
strpos neglects the underscore in its name, uses the search argument last and subject being searched first.
There's absolutely no convention even between functions within the "str" functions. <|eor|><|sor|>Things like this are why, after so many years, I still have to Google basic functions to make sure I'm getting the argument order correct.<|eor|><|eols|><|endoftext|> | 10 |
lolphp | Netrilix | c9pydtr | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|sor|>As someone who uses PHP for tons of little hacky scripts at work ("When all you have is a hammer, every problem looks like a nail", but hey, it gets the job done quickly), this does not surprise me even a little bit.
Take str_replace and strpos, for example:
str_replace uses an underscore in its name, uses the search argument first and subject being searched last (with the replace value in between).
strpos neglects the underscore in its name, uses the search argument last and subject being searched first.
There's absolutely no convention even between functions within the "str" functions. <|eor|><|eols|><|endoftext|> | 7 |
lolphp | dafragsta | c9plkls | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|sor|>I can't believe more people don't run into that.<|eor|><|sor|>In the wild, this probably isn't too big of an issue once you figure out the parameters to make it work. It is still dumb IMO that they don't work with default parameters.<|eor|><|sor|>I ran into it and just assumed it worked with no extra params. I figured out really quick that Excel couldn't open them, so I didn't have to spend too much time pinning down the problem, but still.<|eor|><|eols|><|endoftext|> | 6 |
lolphp | InconsiderateBastard | c9pln5q | <|sols|><|sot|>fgetcsv()/fputcsv() were both added in PHP 5.1.0. They are incompatible: fgetcsv() parses backslash escapes, but fputcsv() uses quote doubling (and does not escape backslashes).<|eot|><|sol|>http://codepad.org/YwM05DEV<|eol|><|sor|>I can't believe more people don't run into that.<|eor|><|sor|>In the wild, this probably isn't too big of an issue once you figure out the parameters to make it work. It is still dumb IMO that they don't work with default parameters.<|eor|><|sor|>I ran into it and just assumed it worked with no extra params. I figured out really quick that Excel couldn't open them, so I didn't have to spend too much time pinning down the problem, but still.<|eor|><|sor|>Excel being able to open the result is irrelevant. There are plenty of valid CSV files that Excel has trouble opening. The problem is when the output of PutCsv can't be opened by default using GetCsv. That's just dumb.<|eor|><|eols|><|endoftext|> | 5 |
lolphp | jdh28 | 5bu2uu | <|sols|><|sot|>DateTime::ISO8601 is not ISO-8601 compatible<|eot|><|sol|>http://php.net/manual/en/class.datetime.php#datetime.constants.types<|eol|><|eols|><|endoftext|> | 101 |
lolphp | ebvalaim | d9sqcml | <|sols|><|sot|>DateTime::ISO8601 is not ISO-8601 compatible<|eot|><|sol|>http://php.net/manual/en/class.datetime.php#datetime.constants.types<|eol|><|sor|>[ISO8601 has changed several times over the years.](https://en.wikipedia.org/wiki/ISO_8601#History)
* ISO 8601:1988
* ISO 8601:2000
* ISO 8601:2004
<|eor|><|sor|>Which one of them is PHP compatible with?<|eor|><|sor|>ISO 8601:PHP<|eor|><|eols|><|endoftext|> | 45 |
lolphp | eliasv | d9rlsnm | <|sols|><|sot|>DateTime::ISO8601 is not ISO-8601 compatible<|eot|><|sol|>http://php.net/manual/en/class.datetime.php#datetime.constants.types<|eol|><|sor|>Some people get frustrated with e.g. Java due to the burden backward compatibility places on the speed and direction of language and core library development ... but this makes it sound like the PHP designers are intentionally keeping straight up *bugs* around for the sake of backward compatibility. Interesting decision on their part.<|eor|><|eols|><|endoftext|> | 36 |
lolphp | Deviltry1 | d9r8dly | <|sols|><|sot|>DateTime::ISO8601 is not ISO-8601 compatible<|eot|><|sol|>http://php.net/manual/en/class.datetime.php#datetime.constants.types<|eol|><|sor|>https://www.reddit.com/r/lolphp/search?q=ISO8601&restrict_sr=on<|eor|><|eols|><|endoftext|> | 20 |
lolphp | badmonkey0001 | d9rnu1p | <|sols|><|sot|>DateTime::ISO8601 is not ISO-8601 compatible<|eot|><|sol|>http://php.net/manual/en/class.datetime.php#datetime.constants.types<|eol|><|sor|>[ISO8601 has changed several times over the years.](https://en.wikipedia.org/wiki/ISO_8601#History)
* ISO 8601:1988
* ISO 8601:2000
* ISO 8601:2004
<|eor|><|eols|><|endoftext|> | 13 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.