(PHP 8 >= 8.3.0)
str_decrement — Decrementa una stringa alfanumerica
Restituisce la stringa ASCII alfanumerica
string decrementata.
stringLa stringa di input.
Restituisce la stringa ASCII alfanumerica decrementata.
Viene lanciato un ValueError se
string è vuota.
Viene lanciato un ValueError se
string non è una stringa
ASCII alfanumerica.
Viene lanciato un ValueError se
string non può essere decrementata.
Ad esempio, "A" o "0".
Example #1 Esempio base di str_decrement()
<?php
$str = 'ABC';
var_dump(str_decrement($str));
?>Il precedente esempio visualizzerà:
string(3) "ABB"
Example #2 Esempio di str_decrement() con riporto
<?php
$str = 'ZA';
var_dump(str_decrement($str));
$str = 'AA';
var_dump(str_decrement($str));
?>Il precedente esempio visualizzerà:
string(2) "YZ" string(1) "Z"