« first day (1466 days earlier)      last day (3482 days later) » 

user1994804
1:01 PM
So once more... Why the # symbols in this example?
 
So its regexp delimiter - it could also be typical / there
 
1:37 PM
If I refer to an HTTP method as a "verb" (in property and method names) is that a bad convention? I know it's a recognized synonym, but would the populace-at-large look at that and go "ugh"?
 
@PeeHaa where?
 
@AndreaFaulds It turns out that float validation is A Very Tricky Thing (who could have guessed?). isNumeric() doesn't cut it since it accepts hex values which can't be cast to float (e.g. "0x10").
So now I'm back to regular expressions :)
One issue I'm running into is that the to_float((string) (PHP_INT_MAX * 2)) test fails on 64-bit platforms: "Failed asserting that 1.844674407371E+19 is identical to 1.844674407371E+19." Any ideas?
 
@TheodoreBrown php.net/manual/en/language.operators.comparison.php "Because of the way floats are represented internally, you should not test two floats for equality."
aka PHP sucks.
 
@TheodoreBrown FILTER_VALIDATE_FLOAT ?
 
@AndreaFaulds Yeah, actually I think that might work but I was trying to avoid it. I'll probably have to use it, though.
 
1:49 PM
@PeeHaa nevermind, fixed
 
@Danack Not a PHP flaw, and not this issue
they're talking about how 0.1 * 10 !== 10
You can test for equality, it's just rarely a good idea with floats in any language
anyway gtg Linguistics lecture
 
@ircmaxell Question for you. What's the reason that a singleton proves faster than or identical to instantiating a class on PHP 7, but much slower PHP < 7? 3v4l.org/jhp2o
 
@TumblrGuy because GC still needs tweaking?
I dunno, will need to dig through it to figure it out
 
@ircmaxell I'm just looking for some place to start digging where the performance cost will make sense. Can you explain how the GC is slowing it down?
Ahh OK. Thanks then.
 
my gut is allocation is happening in 7 that isn't in 5
in that it's reusing the object id for 5, but not for 7
 
1:54 PM
The singleton is faster in 7
even faster than doing new Foo
That baffles me.
 
tnat's not it
could be that the hash table fetch was made much more effecient in 7....
 
@AndreaFaulds I thought this case was because the internal representation of floats usually has more bits that the short version that is displayed - 3v4l.org/lXhIM#v440 - not just the some value can't be represented in float.
 
Yea, that sound about right. Perhaps the static variables for the class are allocated differently.
I have to say. I'm still amazed at out how much PHP 7 blows HHVM out of the water.
 
in some cases
in some, it's significantly slower still
 
posted on October 21, 2014 by kbironneau

/* by Arekibian */

 
2:01 PM
which is going to happen, and is ok
 
@Danack Right, though that's a different issue to the one the manual's on about.
 
I'm just happy I don't need 5 times as many servers to run the same code :)
 
@YourAdrenalineFix You don't need ' on the whys and hows.
Unless something belongs to why.
 
Okay - but the internal representation vs string representation is also probably the one that Theodore is seeing.
 
And this is coming from some yokel from Bosnia so you should be ashamed of your English.
 
2:05 PM
@Danack Yep
 
@Danack When you want to compare floats you should probably consider that the comparison typically only makes sense within a certain precision given that it's limited precision math... 3v4l.org/MKSKc
 
@TumblrGuy thanks. I know.
 
OK, I just wanted to point out that it's a problem of limited precision, not a problem of PHP.
You get this same exact problem in any language where you have limited precision math.
If you want to do arbitrary precision there's always bcmath and gmp
 
Thanks I know and that's not the problem here - it's the fact that the string representation of the float doesn't contain all of the precision in the float and so the string appears to be the same while the test fails: 3v4l.org/SNai4
27 mins ago, by Theodore Brown
One issue I'm running into is that the to_float((string) (PHP_INT_MAX * 2)) test fails on 64-bit platforms: "Failed asserting that 1.844674407371E+19 is identical to 1.844674407371E+19." Any ideas?
 
ah precision issues
 
2:15 PM
@webarto any chance you can push #2? I can deal with tidying up the markup if needed
 
Yes, just got home, give me few.
 
@Danack Yes, that's what limited precision is :)
 
@Danack I can't imagine a scenario where I would have to deal with such numbers in PHP and web development. Can you hint a few?
 
@Danack Let me make it clearer for you 3v4l.org/s74Rg
:)
I forget that 3v4l doesn't let you use ini_set maybe this would have made it more obvious, but I think you'll get the point codepad.viper-7.com/qTxFRc
 
You shouldn't star my stupidity.
13
 
2:27 PM
@webarto Just had the same thought. :)
 
:)
 
What does that even mean?
 
lol @Feeds :p
 
2:41 PM
By the way...
@TheodoreBrown I tested it by casting back to string, if you look at the file.
Well, essentially all PHPTs work like that.
 
@AndreaFaulds I was already in the process of changing my test to do the same :)
 
Aha :)
More specifically, checking what var_dump outputs
 
Ugh I hate not knowing how I should structure my code.
 
And FILTER_VALIDATE_FLOAT won't do anything for me since the issue is about equality, not validation
 
Je suis noob
Anyone want to write some psuedo-code for me for e-hugs? :P
 
user1994804
2:45 PM
Im learning regex and have a question
 
user1994804
on this page
 
user1994804
Under the Heading "Literal Characters"
 
@TheodoreBrown Did you see the link I pasted above?
 
@TheodoreBrown The main thing I'm checking is it validates as a float
Not the specific output
 
user1994804
2:47 PM
In the third paragraph why doesn't it say ] or } is a literal character
 
user1994804
?
 
though checking the first few digits come out right matters
Also, bear in mind that's only there for consistency w/ to_int test
 
user1994804
Typo?
 
@YourAdrenalineFix Probably because they're trying to write an ungreedy paragraph
 
@TumblrGuy Yes, thanks.
 
user895378
2:48 PM
@DaveRandom I would really like this too.
 
user895378
morning
 
user895378
@Fabien oh noes! must be infinitely looping in there. Will fix and ping.
 
@rdlowrey I would also like that.
Properties are cool, but readonly would be good.
 
user895378
I use a lot of public properties lately to avoid fcall overhead for public function getThing() { return $this->thing; }
 
user895378
For internal code. Read-only properties would be extremely helpful.
 
2:51 PM
I think they'd be easy to code, too...
Might try to implement it later.
It's also more readable than a property IMO
 
@rdlowrey :) cheers.
 
class Foo { public readonly $bar; } vs class Foo { public $Bar { get; }; } (ew)
 
user895378
yeah the readonly keyword would be really great.
 
user1994804
Oops I meant to say why doesn't it say ] and } have special meaning?
 
user1994804
@Machavity could u elaborate?
 
2:53 PM
@YourAdrenalineFix because they don't on their own
 
user1994804
Well why does the examples in the paragraph include )
 
user1994804
@KevinMGranger did u look at the paragraph I mentioned?
 
user1994804
3rd paragraph under the heading "Literal Characters"
 
user895378
@webarto European footballers seem to have a higher incidence of racist tendencies than the average citizen. Maybe it just seems so because their actions are more newsworthy, though.
 
2:55 PM
@YourAdrenalineFix because ) is special on its own.
 
@YourAdrenalineFix good point. I think most RegEx engines would require escaping those. rubular.com/r/MMzhtZChrM
 
@CameronHurd [ and { are special on their own, } and ] are not, in most engines (at least those I can recall)
 
@rdlowrey Forgot to mentioned he's Albanian :D Related to the flag incident the other day.
 
user1994804
Doesnt it seem that the nearly last sentence is missing something?
 

« first day (1466 days earlier)      last day (3482 days later) »