Actually, this is the only RFC about scalar type hinting which might be okay, but I'm still not sure if I'd really want it…
e.g. just like I want to pass a "0" from the db to a boolean parameter, but which couldn't be passed through as it'd be lossy. ("0" !== (string)(bool)"0")
@tereško Ugh....you will either love that series or hate it. I recommend not reading it if you actually like thinking about what you're reading.
Short version and not too spoilerish, there are some major internal consistencies with the story line, that make the reading of all 3 books be a great big 'meh'.
How can I access the profile on a unit test context where there is no request?
In my case, I'm making tests to a data access layer that uses some other DBAL, doctrine2 in my case, and I want to assure that only a certain number of queries are made for performance issues. Don't want to put http ...
And I'm also wondering whether we (internals people) are misrepresenting what the community wants. I does seem like the strict hinting has the strongest community support, as odd as that seems to me (I would expect people to fight for the reverse ^^)
I think 2 ways make sense: booleans support casting from everything (meaning array() is valid input), or nothing. Otherwise things start getting really weird
@zerkms if you put a gun to my head an demanded an answer of me, I would say that yes, the ability to work efficiently at the large scales means that you can't operate as efficiently at the small scale, and it follows that efficiency is relative depending on the scale you are working with. It's probably approximately an inverse exponent. But that's totally just pulling numbers out of thin air, and I didn't even give any numbers
And even then, I'd argue that from a code clarity perspective, fun($i != 0) is a lot better than fun($i), where it's totally non-obvious that you're actually passing a boolean cond there
yeh I may get in on that action, sounds like it might be interesting, looks like there are a few people going who I've wanted to meet for a while and also some people who I've not seen for ages
The more I think about it the more I would be OK with just not having a bool type hint at all. There's only really one thing you can do with a bool, the point of scalar type hints is to remove the ambiguity in things you can do lots of things with (numbers and strings).
I would like to see a more strict type hint - but I be happy with the proposed rfc as long as the following sentence holds "Conversion is allowed only if data-loss does not happen."
I can't explain any better than the on hold box does. Pick a specific coding question and ask that. You are asking for three very broad answers here. — Andrew Barber ♦16 hours ago
@zerkms exactly. If it accepts stuff other that bools, all you get is the knowledge that it's a bool -> you gain nothing. If you accept only bools, no-one will ever use it because the only thing you can ever do with a bool is test it for truthy-ness -> you gain nothing. I get the point of implicit number/string casts, but bools just seem pointless after I've thought it through. Apparently that's not a popular opinion though :-P
I can't explain any better than the on hold box does. Pick a specific coding question and ask that. You are asking for three very broad answers here. — Andrew Barber ♦16 hours ago
@IGotRoot Seriously? "Three main goals for me to understand how to do the AJAX implementation before the main question will be marked solved: " - I'm not sure it's possible to explain how that is too broad a question.
When running my script, I am getting several errors like this:
Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23
The lines mentioned in the error messages contain header() and setcookie() calls.
What could...
When running my script, I am getting several errors like this:
Warning: Cannot modify header information - headers already sent by (output started at /some/file.php:12) in /some/file.php on line 23
The lines mentioned in the error messages contain header() and setcookie() calls.
What could...
Warning: Cannot modify header information - headers already sent by (output started at /Applications/XAMPP/xamppfiles/htdocs/photo/download.php:63) in /Applications/XAMPP/xamppfiles/htdocs/photo/download.php on line 73
@RahulKhosla random-tangent don't output <h1> in a loop, there should only ever be one h1 on a page
Oh also don't give elements the same id="" attribute in a loop either, there can only be one element with the same id on a page (it's an identifier, it's unique)