CKTIS / PHP
PHP type string
A PHP string is a sequence of bytes and can contain a zero byte.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
string $textA PHP string is a sequence of bytes and can contain a zero byte. Length and indexing operate on bytes, so a single visible character encoded in UTF-8 may occupy several positions. Binary data and human-readable text share the same string type. Choose a text-aware operation when counting characters.
$text = "\u{00E9}\0";
echo json_encode([strlen($text), bin2hex($text[0]), bin2hex($text)]);
[3,"c3","c3a900"]
Examples
<?php
$text = "\u{00E9}\0";
echo json_encode([strlen($text), bin2hex($text[0]), bin2hex($text)]);
Result
[3,"c3","c3a900"]