23
Tue, Apr
1 New Articles

TechTip: PHP 7.0 Is Coming, Part 1

Web Languages
Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

PHP 7.0 is in the process of coming to you now, probably before the end of the year. But why should you care? What does it offer? And when will it be available?

 

Sometime between now and the end of 2015, a new version of PHP, PHP 7, will hit the streets. Currently, most of us are using 5.3 or 5.4, and I'm guessing that many of you are wondering what happened to PHP 6. Did they just skip it, or is there something in the way PHP handles cardinal numbers to cause the jump?

 

The truth is, PHP 6 is out there, but not many people have chosen to use it. Why not? PHP 6 was the release that was going to provide Unicode support for PHP, incorporating the International Components of Unicode (ICU) library into PHP and representing all strings in a UTF-16 format. While this was a nice idea, it required some additional steps during processing as everything had to be taken from the encoding format it was in, converted to UTF-16, and then converted back again. Plus UTF-16 strings take up twice as much space as UTF-8.

 

There wasn't much of a performance gain, so many people opted not to go that direction. Work on the release stalled, and when 5.3 was released in 2009 with many of the non-Unicode features from 6, that sort of put the nail in the coffin. Work on 6 formally stopped in 2010, and 5.4, with still more 6.0-oriented non-Unicode features, followed shortly after.

 

When it came time to look toward the next big release of PHP, the consensus was to let 6 rest in peace and move on to 7 as the flagship number.

 

How Does a New Version of PHP Develop?

Those of us in the RPG world are used to new versions of the language coming out because the software vendor that "owns" the language (IBM, in our case) decides that there's a need for new functionality. True, they take input from the user community, but in the end they develop the list and do the work required to create the new functions. Plus, in the RPG case, there's a stated policy that nothing is ever taken out of the language, so you can upgrade to a new version and not have to worry about your stuff breaking. Yes, some functions were lost when we went to /Free, but you can still use them in procedural code specs, so they're not really deprecated.

 

But PHP is open source. Zend kind of shepherds it along, but there are other versions of it out there, such as the one Facebook has.

 

Anyone can propose an idea for incorporation into a new release, although that's usually done only by some of the top developers. It's assumed that you'll not only propose the issue, but specify, in very great detail, how it would be approached and then eventually do the work on it. Anyway, you do this by setting up a Request for Comments (RFC) on the PHP Wiki. The RFC is left open for at least two weeks but often for longer while people review and comment on the proposed change. Then a vote is called for by the author whenever the discussion seems to have run its course. Things that receive a majority vote are then approved for incorporation into the next release.

 

Because things are brought up and voted on individually, the process may string along for awhile and not everything is released simultaneously. The first version of PHP 7, which will contain some but not all of the functional enhancements, will be out probably in June, but that's pretty much just for hard-core developers. It certainly will not be available to everyone. Why not? Because it's not like a new version of a browser, where you download IE15 and suddenly you have all the capabilities. PHP is a server-side language, so you don't really have access to the language except through the "stack" in your server environment. Real developers tend to "roll their own." That is, they have all of the software for the PHP stack loaded on their PC, so they can download the new version of the language and be ready to go. More-normal people have access to a copy of Zend Server or else use MAMP/WAMP/LAMP on their PCs. So PHP 7 will not really be available to them until it's incorporated into those products.

 

The full version of the software will probably not be out till close to the end of the year. And when that happens, what will we see? Ah, that's the question now, isn't it?

 

So What Is PHP 7 All About?

We are used to the first release of a new flagship number being a big one, something that dramatically extends the language or takes it in a new direction, such as PHP 3 adding OO functionality. So what's the focus in 7?

 

Certainly there are functionality improvements: the introduction of strict typing, the Space Ship Operator (<=> ) so named because it sort of looks like a Star Wars TIE Fighter, and many others. Plus, it does fix some past inconsistencies that are sitting out there.

 

But probably the biggest story is performance. PHP 7 is dramatically faster than previous versions, probably twice as fast as 5.6, according to available benchmarks. Apps will not only run faster but, because they do, they will require less server power, which means less electricity, making 7 a very green web language. There are a ton of bench marks out there on the web comparing 7 to HHVM, but the examples Zend provides show how superior 7 is to the current 5.6. Up to this point, the performance leader in the PHP world was Facebook's version of HHVM, but 7 seems to be able to beat even that.

 

How has PHP gotten this performance boost? Well the first ingredient is PHPNG. This is a refactored version of the existing Zend Engine, the thing that makes PHP run. With PHP 7, PHPNG is now the main engine, replacing the old core. What's different between PHPNG and the old engine is the way that PHPNG handles data, particularly data structures, doing so more efficiently and using less storage. For example, the new engine now differentiates between native data types, like integers, and more complex types, like arrays. By not having native data types go through all the manipulations that complex types go through, PHPNG saves a great many instructions as well as storage. Plus, even the way complex types are handled is much more efficient. For example, hash tables upon which arrays (which are very important in PHP) are based are now handled in a very C-like manner (remember, under the covers, PHP is written in C) rather than the way most dynamic languages do. The result is a tremendous savings in processing power and storage required to handle a given app.

 

The other thing that has happened is the addition of an Abstract Syntax Tree (AST) structure to the "compile" process. The AST is a tree structure representation of the script, which consists of nodes that represent the various functions within the script. As the tree is built, additional annotation information can be added to it to separate the parsing of the script from the implementation of the code. In essence, it separates the code syntax from the parsing process so that many of the syntax-related rules that are now required in 5.4 will not be needed, resulting in a simpler, more-consistent syntax structure.

 

As an aside, Facebook's HHVM uses a JIT precompiler to provide its performance boost, and Zend looked at that as they went through this process. In the end, Zend decided that, while this did improve the benchmark, it had relatively little impact on the running of actual applications. As a result, no JIT precompiler will be used, but ongoing improvements in PHPNG should continue to net performance gains.

 

But There's More…Next Month

There's more to PHP 7 than lightning speed. There's also a series of functionality improvements that we shall go into in the next exciting installment. Stay tuned.

 

David Shirey

David Shirey is president of Shirey Consulting Services, providing technical and business consulting services for the IBM i world. Among the services provided are IBM i technical support, including application design and programming services, ERP installation and support, and EDI setup and maintenance. With experience in a wide range of industries (food and beverage to electronics to hard manufacturing to drugs--the legal kind--to medical devices to fulfillment houses) and a wide range of business sizes served (from very large, like Fresh Express, to much smaller, like Labconco), SCS has the knowledge and experience to assist with your technical or business issues. You may contact Dave by email at This email address is being protected from spambots. You need JavaScript enabled to view it. or by phone at (616) 304-2466.


MC Press books written by David Shirey available now on the MC Press Bookstore.

21st Century RPG: /Free, ILE, and MVC 21st Century RPG: /Free, ILE, and MVC
Boost your productivity, modernize your applications, and upgrade your skills with these powerful coding methods.
List Price $69.95

Now On Sale

BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$0.00 Raised:
$

Book Reviews

Resource Center

  • SB Profound WC 5536 Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application. You can find Part 1 here. In Part 2 of our free Node.js Webinar Series, Brian May teaches you the different tooling options available for writing code, debugging, and using Git for version control. Brian will briefly discuss the different tools available, and demonstrate his preferred setup for Node development on IBM i or any platform. Attend this webinar to learn:

  • SB Profound WP 5539More than ever, there is a demand for IT to deliver innovation. Your IBM i has been an essential part of your business operations for years. However, your organization may struggle to maintain the current system and implement new projects. The thousands of customers we've worked with and surveyed state that expectations regarding the digital footprint and vision of the company are not aligned with the current IT environment.

  • SB HelpSystems ROBOT Generic IBM announced the E1080 servers using the latest Power10 processor in September 2021. The most powerful processor from IBM to date, Power10 is designed to handle the demands of doing business in today’s high-tech atmosphere, including running cloud applications, supporting big data, and managing AI workloads. But what does Power10 mean for your data center? In this recorded webinar, IBMers Dan Sundt and Dylan Boday join IBM Power Champion Tom Huntington for a discussion on why Power10 technology is the right strategic investment if you run IBM i, AIX, or Linux. In this action-packed hour, Tom will share trends from the IBM i and AIX user communities while Dan and Dylan dive into the tech specs for key hardware, including:

  • Magic MarkTRY the one package that solves all your document design and printing challenges on all your platforms. Produce bar code labels, electronic forms, ad hoc reports, and RFID tags – without programming! MarkMagic is the only document design and print solution that combines report writing, WYSIWYG label and forms design, and conditional printing in one integrated product. Make sure your data survives when catastrophe hits. Request your trial now!  Request Now.

  • SB HelpSystems ROBOT GenericForms of ransomware has been around for over 30 years, and with more and more organizations suffering attacks each year, it continues to endure. What has made ransomware such a durable threat and what is the best way to combat it? In order to prevent ransomware, organizations must first understand how it works.

  • SB HelpSystems ROBOT GenericIT security is a top priority for businesses around the world, but most IBM i pros don’t know where to begin—and most cybersecurity experts don’t know IBM i. In this session, Robin Tatam explores the business impact of lax IBM i security, the top vulnerabilities putting IBM i at risk, and the steps you can take to protect your organization. If you’re looking to avoid unexpected downtime or corrupted data, you don’t want to miss this session.

  • SB HelpSystems ROBOT GenericCan you trust all of your users all of the time? A typical end user receives 16 malicious emails each month, but only 17 percent of these phishing campaigns are reported to IT. Once an attack is underway, most organizations won’t discover the breach until six months later. A staggering amount of damage can occur in that time. Despite these risks, 93 percent of organizations are leaving their IBM i systems vulnerable to cybercrime. In this on-demand webinar, IBM i security experts Robin Tatam and Sandi Moore will reveal:

  • FORTRA Disaster protection is vital to every business. Yet, it often consists of patched together procedures that are prone to error. From automatic backups to data encryption to media management, Robot automates the routine (yet often complex) tasks of iSeries backup and recovery, saving you time and money and making the process safer and more reliable. Automate your backups with the Robot Backup and Recovery Solution. Key features include:

  • FORTRAManaging messages on your IBM i can be more than a full-time job if you have to do it manually. Messages need a response and resources must be monitored—often over multiple systems and across platforms. How can you be sure you won’t miss important system events? Automate your message center with the Robot Message Management Solution. Key features include:

  • FORTRAThe thought of printing, distributing, and storing iSeries reports manually may reduce you to tears. Paper and labor costs associated with report generation can spiral out of control. Mountains of paper threaten to swamp your files. Robot automates report bursting, distribution, bundling, and archiving, and offers secure, selective online report viewing. Manage your reports with the Robot Report Management Solution. Key features include:

  • FORTRAFor over 30 years, Robot has been a leader in systems management for IBM i. With batch job creation and scheduling at its core, the Robot Job Scheduling Solution reduces the opportunity for human error and helps you maintain service levels, automating even the biggest, most complex runbooks. Manage your job schedule with the Robot Job Scheduling Solution. Key features include:

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • LANSAWhen it comes to creating your business applications, there are hundreds of coding platforms and programming languages to choose from. These options range from very complex traditional programming languages to Low-Code platforms where sometimes no traditional coding experience is needed. Download our whitepaper, The Power of Writing Code in a Low-Code Solution, and:

  • LANSASupply Chain is becoming increasingly complex and unpredictable. From raw materials for manufacturing to food supply chains, the journey from source to production to delivery to consumers is marred with inefficiencies, manual processes, shortages, recalls, counterfeits, and scandals. In this webinar, we discuss how:

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • Profound Logic Have you been wondering about Node.js? Our free Node.js Webinar Series takes you from total beginner to creating a fully-functional IBM i Node.js business application.

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: