CKTIS / PHP
strrev()
Return the bytes in reverse order.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
strrev(string $string): stringReturn the bytes in reverse order. An ASCII word reverses as expected, but a UTF-8 code point encoded in several bytes can become invalid UTF-8. Inspect hexadecimal output when reversing arbitrary binary input.
Signature
strrev(string $string): string
Example output
["21BA","a9c341",""]
Examples
<?php
echo json_encode([strrev("AB12"),bin2hex(strrev("A\u{00E9}")),strrev("")]);
Result
["21BA","a9c341",""]