Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Evert Pot:
Strict typing in PHP 7 - poll results
Jan 15, 2016 @ 17:19:54

Evert Pot has shared the results of a poll he recently set up on Twitter asking PHP developers if they planned to make use of the strict typing functionality in PHP 7 in their applications. Unsurprisingly, the majority voted that they will with a more undecided audience coming in second.

Type hinting comes in two flavors: strict and non-strict. This is the result of a long battle between two camps, a strict and non-strict camp, which in the end was resolved by this compromise.

Now by default PHP acts in non-strict mode, and if you'd like to opt-in to strict-mode, you'll need to start every PHP file with this statement. [...] So I was curious about everyone and whether you will be using strict mode or not. Results are in.

According to those that voted 46% were completely in favor of using the declare statement to enable strict typing in their PHP 7 code by default. The next group, the "undecided" were at 26% with "no way" and "what is that?" coming in farther down the list. He also mentions a package that's in the works from Justin Martin that would automatically add the declare statement to your code in the desired location(s). Additionally there's an extension in development from Joe Watkins that will do the same thing but making it a bit more automatic.

tagged: php7 strict type declare poll results usage composer package extension

Link: https://evertpot.com/strict-types-pollresults/

Debuggable Blog:
Better array syntax for PHP: Here's your chance to weigh in
Jun 10, 2008 @ 17:07:03

On the Debuggable blog, Nate Abele has posted a request for opinions on a topic that's been lighting up the PHP mailing lists (and other social media) lately - the alternative array syntax for PHP.

Well, there's a patch available, but 2/3 of the active PHP committers (who participated in the vote) voted against its inclusion. However, of the end-users participating in the discussion, 17 out of 20 voted in favor. Shortly before the voting was concluded, there was a call for some user-land input, so I decided to humbly submit my two pennies.

His comments support the idea, noting that arrays are "our bread and butter" for the language and should be updated to make them even easier to use (and more in line with the declarations of other variable types).

tagged: array syntax declare update alternative opinion

Link:

PHP 10.0 Blog:
We are doomed! (and Ticks in PHP)
Jun 20, 2007 @ 15:29:00

In this new post to the PHP 10.0 blog, Stas mentions the "impending doom" of PHP that's been going around the community, including in this post on the TechRepublic site.

He does, however, branch off into something much more interesting that seems to be somewhat ignored by developers - the use of ticks on their code:

This is something named "ticks" - I wonder how many of the PHP developers heard about it and of those how many actually used it. Could it be used for offloading long-running I/O-bound tasks or grouping them together (e.g. so we could wait for DB and HTTP in parallel and not sequentially)? Would there be any use at all for such functionality and if so - how it's supposed to work? I.e. how would you know it's done and how you would collect and use the results?

It's suggested in the comments that it could be used for any kind of application that might need the pseudo-multithreading it offers (including something like scripts needing multiple TCP connections).

tagged: doom tick multithread declare construct doom tick multithread declare construct

Link:

PHP 10.0 Blog:
We are doomed! (and Ticks in PHP)
Jun 20, 2007 @ 15:29:00

In this new post to the PHP 10.0 blog, Stas mentions the "impending doom" of PHP that's been going around the community, including in this post on the TechRepublic site.

He does, however, branch off into something much more interesting that seems to be somewhat ignored by developers - the use of ticks on their code:

This is something named "ticks" - I wonder how many of the PHP developers heard about it and of those how many actually used it. Could it be used for offloading long-running I/O-bound tasks or grouping them together (e.g. so we could wait for DB and HTTP in parallel and not sequentially)? Would there be any use at all for such functionality and if so - how it's supposed to work? I.e. how would you know it's done and how you would collect and use the results?

It's suggested in the comments that it could be used for any kind of application that might need the pseudo-multithreading it offers (including something like scripts needing multiple TCP connections).

tagged: doom tick multithread declare construct doom tick multithread declare construct

Link:



YoungCoders.com:
The PHP Construct You've Never Used
Sep 19, 2006 @ 12:38:14

As pointed out by the Zend Developer Zone today, there's a useful forum post over on the YoungCoders.com website that talks about very useful feature that some PHP developers just don't use - ticks.

You've probably never used it, never saw it, or never found a practical use for ticks, a underused and powerful feature of PHP that allows you to implement exceptions in PHP4, do intensive debugging and profiling, check database connections, turn PHP into an event driven language, or harness complex control over your code.

The post talks about what ticks are, how to enable them, and a few examples of how to use them. Check out more about them in this page on the PHP Manual.

tagged: ticks construct tutorial concept example declare ticks construct tutorial concept example declare

Link:

YoungCoders.com:
The PHP Construct You've Never Used
Sep 19, 2006 @ 12:38:14

As pointed out by the Zend Developer Zone today, there's a useful forum post over on the YoungCoders.com website that talks about very useful feature that some PHP developers just don't use - ticks.

You've probably never used it, never saw it, or never found a practical use for ticks, a underused and powerful feature of PHP that allows you to implement exceptions in PHP4, do intensive debugging and profiling, check database connections, turn PHP into an event driven language, or harness complex control over your code.

The post talks about what ticks are, how to enable them, and a few examples of how to use them. Check out more about them in this page on the PHP Manual.

tagged: ticks construct tutorial concept example declare ticks construct tutorial concept example declare

Link:

Brian Moon's Blog:
Initializing & typing variables with settype()
Sep 14, 2006 @ 12:01:47

In his latest post, Brian Moon talks about a method to help you and your code fit into an E_STRICT style of coding - the settype function.

These days, the way to develop is to have E_ALL and maybe even throw in E_STRICT if you are really hard core. That of course means having all your variables initialized before they are used.

In his view, defining them is good, but it's more "elegant" to use the settype function to make it more clear where they are defined. He also includes a function, using settype, that ensures that the entered values are what they should be (i.e. and int is an int).

tagged: initializing typing variables settype declare e_strict initializing typing variables settype declare e_strict

Link:

Brian Moon's Blog:
Initializing & typing variables with settype()
Sep 14, 2006 @ 12:01:47

In his latest post, Brian Moon talks about a method to help you and your code fit into an E_STRICT style of coding - the settype function.

These days, the way to develop is to have E_ALL and maybe even throw in E_STRICT if you are really hard core. That of course means having all your variables initialized before they are used.

In his view, defining them is good, but it's more "elegant" to use the settype function to make it more clear where they are defined. He also includes a function, using settype, that ensures that the entered values are what they should be (i.e. and int is an int).

tagged: initializing typing variables settype declare e_strict initializing typing variables settype declare e_strict

Link:


Trending Topics: