Название: PHP Cookbook: Modern Code Solutions for Professional PHP Developers (7th Early Release) Автор: Eric A Mann Издательство: O’Reilly Media, Inc. Год: 2023-03-03 Страниц: 330 Язык: английский Формат: epub Размер: 10.2 MB
If you're a PHP developer looking for proven solutions to common problems, this cookbook provides code recipes to help you resolve numerous scenarios. By leveraging modern versions of PHP through version 8.1, these self-contained recipes provide fully realized solutions that can help you solve similar problems in your day-to-day work.
Whether you're new to development or merely new to PHP, these recipes will help you unpack the most powerful features of this programming language. Author Eric Mann, a regular contributor to php(architec magazine, frequently makes presentations on software architecture and has built scalable projects for startups and Fortune 500 companies alike.
Many basic PHP scripts handle operations synchronously - meaning the script runs one, monolithic process from start to finish and only does one thing. However, more sophisticated applications have become commonplace in the world of PHP so more advanced modes of operation are required as well. Namely, asynchronous programming has quickly become a rising concept for PHP developers. Learning how to do two (or more) things at the same time within your scripts is vital to building modern applications.
There are two words that come up frequently when writing about asynchronous programming: concurrent and parallel. When most people talk about parallel programming what they really mean to say is concurrent programming. With concurrency, your application does two different things but not necessarily at the same time. Think of a single barista serving multiple customers at once - she is multi-tasking and making several different drinks but can only really make one drink at a time.
With parallel operations, you are doing two different things simultaneously. Imagine installing a Coke machine on the counter in the cafe. Some patrons are still being served by the barista, but others can get their caffeine fix from a separate machine in parallel.
There is also a third concept of “concurrent parallel” operations, which is where two different work streams operate at the same time (parallel) but also multi-task their individual work streams (concurrent). While a useful composite concept, this chapter instead focuses on the two, separate concepts alone.
Most PHP you’ll find in the wild, modern or legacy, is written to leverage a single thread of execution. This means the code is written to be neither concurrent or parallel. In fact, many developers avoid PHP entirely when they want to leverage concurrent or parallel concepts and turn to languages like jаvascript or GoLang for their applications. Modern PHP, though, fully supports both modes of execution - with or without additional libraries. To fully understand asynchronous PHP, you need to understand at least two specific concepts: promises and coroutines.
Learn the type system of modern PHP Build efficient applications composed of functions and objects Understand key concepts such as encryption, error handling, debugging, and performance tuning Explore the PHP package/extension ecosystem Learn how to build basic web and basic command-line applications Work securely with files on a machine, both encrypted and in plain text
Внимание
Уважаемый посетитель, Вы зашли на сайт как незарегистрированный пользователь.
Мы рекомендуем Вам зарегистрироваться либо войти на сайт под своим именем.
Информация
Посетители, находящиеся в группе Гости, не могут оставлять комментарии к данной публикации.