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

SitePoint PHP Blog:
Parallel Programming with Pthreads in PHP – the Fundamentals
Mar 24, 2017 @ 15:40:07

The SitePoint PHP blog has posted a tutorial that introduces some of the fundamentals of parallel programming in PHP. In their examples they make use of the pthreads extension to help bring simpler parallel programming to the language (otherwise you'd have to do odd things with shell commands and foreground/background controls).

PHP developers seem to rarely utilise parallelism. The appeal of the simplicity of synchronous, single-threaded programming certainly is high, but sometimes the usage of a little concurrency can bring some worthwhile performance improvements.

In this article, we will be taking a look at how threading can be achieved in PHP with the pthreads extension. This will require a ZTS (Zend Thread Safety) version of PHP 7.x installed, along with the pthreads v3 installed.

Despite the article being about the use of pthreads, it starts out talking about when not to use it, possibly saving you some time in the long run. With that out of the way it then starts in on the handling of "on-off tasks" with an example of fetching the "title" value from Google.com. This is then enhanced showing how to use the "Threaded" base class to define other classes that can be used inside of threads. The article moves on covering other topics including:

  • recycling threads
  • pthreads and (im)mutability
  • synchronization of threads

Each item in the list comes with plenty of example code showing you how to create the classes that execute the threads and the output they should generate.

tagged: parallel programming fundamentals tutorial introduction pthreads extension

Link: https://www.sitepoint.com/parallel-programming-pthreads-php-fundamentals/

PHPMaster.com:
PCI Compliance and the PHP Developer
Mar 07, 2013 @ 17:08:11

On PHPMaster.com today there's a new tutorial that talks about PCI compliance with PHP applications and some of the technology you can use to help conform to its requirements.

In reality, PCI is a set of security guidelines drawn up by a consortium of credit card companies and industry security experts to govern how applications should behave when handling credit or debit card information. The card companies impose these standards on the banks who then impose them on those of us who operate e-commerce sites and the like. In this article we will dispel a couple of persistent myths about PCI, take a 20,000-foot look at what PCI encompasses, and then zero in on those requirements that are most closely associated with coding in general and PHP specifically.

He starts with some common myths about PCI (Payment Card Industry) compliance, including that it only applies to "the big guys" taking payments on the web. He then goes through some of the major points of the PCI requirements and talks about a few of them that specifically relate to the backend code side of things.

tagged: pci compliance payment card industry fundamentals

Link:

PHPMaster.com:
Functional Programming and PHP
Feb 26, 2013 @ 15:43:42

On PHPMaster.com today there's a new tutorial written up by Shameer C looking at functional programming with PHP - some of the basic concepts of it and how much is possible in the language.

Many programmer like to talk about functional programming, but if you ask them if they’ve ever done it, most of their replies will be “No”. The reason is quite simple: we are taught to think in an imperative manner when we first start learning to program, in terms of flow charts and steps to be followed in the program. So in this article I’ll explain some important concepts to functional programming and how to write functional code in PHP.

He starts by defining some of the basic fundamental concepts of functional programming including recursion, referential transparency, higher order functions and lambda functions. He includes a bit of code along the way, showing things a bit more practically.

tagged: functional programming tutorial introduction concepts fundamentals

Link:

Ben Ramsey's Blog:
How To Teach PHP
Oct 13, 2006 @ 16:15:41

Based on some perspectives he gained at this year's PHP Appalachia event and at a Triangle-PHP meeting (talking with David Rasch, Ben Ramsey shares his thoughts on how to teach PHP, more specifically to those with some programming background, but not necessarily a lot of experience.

He (David) suggested that the format for teaching PHP needs to change and that these books need to start not by teaching PHP from the Web but by introducing newbies to PHP concepts by creating command-line applications. The idea being to introduce them early on to OOP and best practices, rather than trying to get them started fast with a simple "Hello, World" Web site.

For Ben, the idea was agreeable, but he wasn't sure on whether or not such an approach would take off with the current book market. He does agree with David, though, that things need to change.

As far as David, his thoughts can be best summed up with this post on his blog, talking about a way to learn PHP without some of the drudge they pass along with the lessons in some of the "Learn PHP Now!" kinds of books. He even includes a table of contents for such a book.

So, which is the better of the two? Well, book publishers still think the second (the give examples and teach practices too) is the proven formula for a good PHP book, but maybe a company out there could benefit from Ben and David's suggestion of a no-nonsense, clean, easy book that fosters an approach supporting the basics, not someone's opinion of good code.

tagged: teach programming developer crash course beginner fundamentals teach programming developer crash course beginner fundamentals

Link:

Ben Ramsey's Blog:
How To Teach PHP
Oct 13, 2006 @ 16:15:41

Based on some perspectives he gained at this year's PHP Appalachia event and at a Triangle-PHP meeting (talking with David Rasch, Ben Ramsey shares his thoughts on how to teach PHP, more specifically to those with some programming background, but not necessarily a lot of experience.

He (David) suggested that the format for teaching PHP needs to change and that these books need to start not by teaching PHP from the Web but by introducing newbies to PHP concepts by creating command-line applications. The idea being to introduce them early on to OOP and best practices, rather than trying to get them started fast with a simple "Hello, World" Web site.

For Ben, the idea was agreeable, but he wasn't sure on whether or not such an approach would take off with the current book market. He does agree with David, though, that things need to change.

As far as David, his thoughts can be best summed up with this post on his blog, talking about a way to learn PHP without some of the drudge they pass along with the lessons in some of the "Learn PHP Now!" kinds of books. He even includes a table of contents for such a book.

So, which is the better of the two? Well, book publishers still think the second (the give examples and teach practices too) is the proven formula for a good PHP book, but maybe a company out there could benefit from Ben and David's suggestion of a no-nonsense, clean, easy book that fosters an approach supporting the basics, not someone's opinion of good code.

tagged: teach programming developer crash course beginner fundamentals teach programming developer crash course beginner fundamentals

Link:

DevShed:
Fundamentals of Recursion in PHP (Part 1)
May 02, 2006 @ 12:31:46

DevShed has posted their latest tutorial today, a look at some of the basics of recursion and working with it in PHP.

Iteration is a straightforward concept. Recursion is a bit more complicated; it can be defined as a regular function that calls itself. PHP supports recursive functions. This article, the first of three parts, will explain recursive functions and help you see why they are useful.

Considering the important role that recursion plays in most programming languages, and specifically in PHP, over this series I'll be demonstrating how to define and use recursive functions with numerous code samples, thus you can learn quickly how to include them in your own PHP scripts.

If you've never used recursion, you're in luck - they start from the very beginning, explaining it with a simple example of pushing the entire contents of an array (with subarrays) out to a file. They use this exmaple as a base to improve the function, adding the function to write the data out. They finish it off with two handy recursive functions for everyday use - one to escape the entire contents of an array and one that does the same, but checks to see if magic quotes is on.

tagged: tutorial fundamentals recursion basic example array tutorial fundamentals recursion basic example array

Link:

DevShed:
Fundamentals of Recursion in PHP (Part 1)
May 02, 2006 @ 12:31:46

DevShed has posted their latest tutorial today, a look at some of the basics of recursion and working with it in PHP.

Iteration is a straightforward concept. Recursion is a bit more complicated; it can be defined as a regular function that calls itself. PHP supports recursive functions. This article, the first of three parts, will explain recursive functions and help you see why they are useful.

Considering the important role that recursion plays in most programming languages, and specifically in PHP, over this series I'll be demonstrating how to define and use recursive functions with numerous code samples, thus you can learn quickly how to include them in your own PHP scripts.

If you've never used recursion, you're in luck - they start from the very beginning, explaining it with a simple example of pushing the entire contents of an array (with subarrays) out to a file. They use this exmaple as a base to improve the function, adding the function to write the data out. They finish it off with two handy recursive functions for everyday use - one to escape the entire contents of an array and one that does the same, but checks to see if magic quotes is on.

tagged: tutorial fundamentals recursion basic example array tutorial fundamentals recursion basic example array

Link:

Scott Mattocks' Blog:
Pro PHP-GTK Now Available
Apr 24, 2006 @ 17:40:51

PHP-GTK users can now rejoice (or even those that want to become PHP-GTK users)! According to Scott Mattocks (the author), the PHP-GTK book is now available.

Pro PHP-GTK is now available. Pro PHP-GTK was written to provide the reader with an understanding of the fundamentals of PHP-GTK. This approach empowers the user with the ability to create applications not by just copying and modifying the examples but by understanding what tools are available to solve a problem and how different pieces of the puzzle work together.

The book goes into the details of parent and child relationships, signals and events, layout, displaying and collecting different types of data and customizing the look and feel of an application.

Scott also includes links to a table of contents [pdf] for the book and a sample chapter for those wanting to try before you buy.

tagged: php-gtk book apress pro available fundamentals details php-gtk book apress pro available fundamentals details

Link:

Scott Mattocks' Blog:
Pro PHP-GTK Now Available
Apr 24, 2006 @ 17:40:51

PHP-GTK users can now rejoice (or even those that want to become PHP-GTK users)! According to Scott Mattocks (the author), the PHP-GTK book is now available.

Pro PHP-GTK is now available. Pro PHP-GTK was written to provide the reader with an understanding of the fundamentals of PHP-GTK. This approach empowers the user with the ability to create applications not by just copying and modifying the examples but by understanding what tools are available to solve a problem and how different pieces of the puzzle work together.

The book goes into the details of parent and child relationships, signals and events, layout, displaying and collecting different types of data and customizing the look and feel of an application.

Scott also includes links to a table of contents [pdf] for the book and a sample chapter for those wanting to try before you buy.

tagged: php-gtk book apress pro available fundamentals details php-gtk book apress pro available fundamentals details

Link:


Trending Topics: