Format a number with leading zeros in PHP
$var = 1234567; echo sprintf('%08d', $var); // Output: // 01234567
PHP setcookie “SameSite=Strict”?
You can use the $options array to set the samesite value, for example:
setcookie($name, $value, [
‘expires’ => time() + 86400,
‘path’ => ‘/’,
‘domain’ => ‘domain.com’,
‘secure’ => true,
‘httponly’ => true,
‘samesite’ => ‘None’,
]);
The value of the samesite element should be either None, Lax or Strict.
How to Create URL Slug from String in PHP
function slugify($urlString) {
$search = array(‘Ș’, ‘Ț’, ‘ş’, ‘ţ’, ‘Ş’, ‘Ţ’, ‘ș’, ‘ț’, ‘î’, ‘â’, ‘ă’, ‘Î’, ‘ ‘, ‘Ă’, ‘ë’, ‘Ë’);
$replace = array(‘s’, ‘t’, ‘s’, ‘t’, ‘s’, ‘t’, ‘s’, ‘t’, ‘i’, ‘a’, ‘a’, ‘i’, ‘a’, ‘a’, ‘e’, ‘E’);
$str = str_ireplace($search, $replace, strtolower(trim($urlString)));
$str = preg_replace(‘/[^\w\d\-\ ]/’, », $str);
$str = str_replace(‘ ‘, ‘-‘, $str);
return preg_replace(‘/\-{2,}’, ‘-‘, $str);
}
Sending multiple non-blocking cURL requests with PHP.
In this tutorial, I will show you how to send multiple non-blocking / asynchronous cURL requests using PHP. Furthermore, I will also show you how to get the output and HTTP response code for each request.
Ce que vous devez savoir sur les Attributes de PHP 8
Les Attributes sont une forme de données structurées, qui permet d’ajouter des métadonnées à nos déclarations de classes, propriétés, méthodes, fonctions, paramètres et constantes.
How to Master the Translation of PHP Apps
Building a truly international application is not just about translating strings. Other issues to consider are date and time formats, currency symbols and pluralization. Programmers often underestimate the complexity of localization and get stuck with homemade code that is a pain to maintain. So, let’s talk about PHP Arrays, gettext, frameworks, and Intl.
Shaarli. The personal, minimalist, super-fast, database free, bookmarking service
Do you want to share the links you discover? Shaarli is a minimalist bookmark manager and link sharing service that you can install on your own server. It is designed to be personal (single-user), fast and handy.
PHP Compatibility Checker
The WP Engine PHP Compatibility Checker can be used by any WordPress website on any web host to check PHP version compatibility.
SymfonyCasts: PHP and Symfony Video Tutorial Screencasts
Simply the Best PHP & Symfony Tutorials
And the official way to learn Symfony
PHP Markdown Extra
Markdown Extra is an extension to PHP Markdown implementing some features currently not available with the plain Markdown syntax. Markdown Extra is available as a separate parser class in PHP Markdown Lib.