News Feed
Sections




News Archive
feed this:

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

Joshua Thijssen:
Internal PHP function usage revisited
August 06, 2014 @ 11:53:34

Joshua Thjissen has revisited some of his PHP internal function statistics, an update from this previous post with some results showing the most (and least) used internal PHP functions in several large projects from GitHub.

A lot of people are asking about functions like isset, empty, print, echo etc, as they are not present in the current result list. The thing is, is that these are not really functions, but language constructs. This means that PHP treats them a bit different than normal functions, and this results sometimes in seemingly "strange" behaviour when trying to use them like regular functions.

He's updated his results, though, to reflect the usage of these "functions" and shared the numbers. Not surprisingly, these constructs show up pretty highly in the new "top 22" list he's produced. With the inclusion of the constructs, the number one item on the list is now "isset" by a very large margin. The full results can be found in this gist.

0 comments voice your opinion now!
internal function usage statistics github revisit construct language

Link: https://www.adayinthelifeof.nl/2014/08/05/internal-php-function-usage-revisited/

Martynas Jusevicius' Blog:
Method overloading in PHP 5
December 02, 2008 @ 10:28:50

Martynas Jusevicius has a new post looking at method overloading in PHP5 - a workaround to make it possible at least.

Method overloading (a feature of object-oriented programing which allows having several class methods with the same name but different signatures) is not implemented in PHP, which is a drawback compared to Java. However, PHP 5 provides a way to imitate overloading by catching calls to "inaccessible methods" with magic method __call.

In his example he uses __call to route the request to the correct version of the constructor (__construct0 or __construct1) based on the number of arguments passed in

0 comments voice your opinion now!
method overload php5 construct call magic function route


Brian Moon's Blog:
Short Array Syntax for PHP
May 29, 2008 @ 11:13:00

There's been some talk floating around about a proposed additional syntax for creating arrays in PHP. Brian Moon sums it up nicely in a new post to his blog.

So, I was asked in IRC today about the proposed short array syntax for PHP. For those that don't know, I mean the same syntax that other languages (javascript, perl, python, ruby) all have. [...] It just feels like a good addition to the language. It is common among web languages and therefore users coming into PHP from other languages may find it more comfortable.

He compares it with other data type creation in PHP (you don't call int() to make an integer, so why call array() to make an array). However, according to a post from the internals mailing list, we might not be seeing this any time soon.

0 comments voice your opinion now!
short syntax array function integer string language construct


PHP-Coding-Practices.com:
How Table Migrations In CakePHP 1.2 Can Save Your Life
July 03, 2007 @ 14:36:07

On PHP-Coding-Practices.com, Tim Koschuetzki has posted a new tutorial that just might save your life - well, at least the life of your CakePHP application - using table migrations.

Migrations are a wonderful technique to keep your database in sync with your code. When working on a project as a team, migrations can save your life. Please join me and get a quick introduction to migrations in CakePHP and become a happier coder.

He starts by explaining what migrations are (yml files that contain database construction/destruction information), how to execute them in your application, and how to construct your own.

0 comments voice your opinion now!
migration table cakephp database construct destruct yml migration table cakephp database construct destruct yml


PHP 10.0 Blog:
We are doomed! (and Ticks in PHP)
June 20, 2007 @ 10: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).

0 comments voice your opinion now!
doom tick multithread declare construct doom tick multithread declare construct


YoungCoders.com:
The PHP Construct You've Never Used
September 19, 2006 @ 07: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.

0 comments voice your opinion now!
ticks construct tutorial concept example declare ticks construct tutorial concept example declare


Mike Wallner's Blog:
__get() and array rumors
August 21, 2006 @ 07:49:03

In a brief new post, Mike Wallner talks about some of the discussion surrounding overloaded array properties lately and something he's discovered about it.

As arrays are the only complex types that are passed by value (resources don't really count here) the solution to described problem is simple: use an object; either an instance of stdClass or ArrayObject will do well, depending if you want to use array index notation.

He includes two code examples, one just trying to overload it in a class with __get (yielding an error) and the other using the constructor to pass an ArrayObject out first, allowing for error-free assignment.

0 comments voice your opinion now!
arrayobject overload array properties get construct arrayobject overload array properties get construct



Community Events





Don't see your event here?
Let us know!


update introduction series language community interview tool framework release install opinion version symfony voicesoftheelephpant package podcast security library laravel composer

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework