Decrement character with php

前端 未结 5 982
盖世英雄少女心
盖世英雄少女心 2021-01-12 01:15

Why is it that it\'s ok to increment character but not decrement with PHP?

PHP



        
5条回答
  •  庸人自扰
    2021-01-12 01:46

    There is no simple way, especially if you start with multi-character strings like 'AA'.

    As far as I can ascertain, the PHP Internals team couldn't decide what to do when

    $x = 'A';
    $x--;
    

    so they simply decided not to bother implementing the character decrementor logic

提交回复
热议问题