Tag

php

Browsing

Recently, I have been taking a deep dive into the the new features arriving in PHP 8. I have already talked about the new string functions in PHP 8, and recently have been doing my due diligence in understanding the new JIT. Along the way, I’ve been learning about the internals of PHP. Specifically, I’ve been reading a lot about the tokenization and opcode generation process. I wanted to be able to view php opcodes…

If you read New String Functions in PHP 8, you might be wondering why multibyte strings are important. Computers are built to process binary digits, and there is a straightforward approach for converting integers to binary. There is even a standard for representing floating point numbers in binary. However, how do all the sentences, words, and characters on this page get represented as binary? The answer is character encoding. Without diving too much into the…

As of right now, three new string functions have been included in the PHP 8. While these three functions do not introduce anything existing built-in functions can’t already accomplish, they are more intuitive. Functions str_contains ( string $haystack , string $needle ) : bool The str_contains function allows you to check if one string is contained within another string. For example: php > var_dump(str_contains(“abc”, “b”)); bool(true) php > var_dump(str_contains(“abc”, “z”)); bool(false) Historically, this could be…