Curiosity: does the one-dimensional array become Boolean after traversing?

problem description

I wonder why an one-dimensional array becomes Boolean after experiencing walk. Ask the boss who knows to help solve the doubt.

related codes

public function test(){
        $arr = ["20181102","20181103","20181104","20181105","20181106","20181107"];
        $arr = array_walk($arr,function($item){
            $item = date_format(date_create($item),"m-d");
        });
        var_dump($arr);
        exit;
    }

in fact, what I expect is that the date is formatted as "month-day".

Oct.28,2021

look at the document: PHP: array_walk

function prototype: bool array_walk (array & $array, callable $callback [, mixed $userdata = NULL])
it returns a Boolean.

not to mention the return value is very clear,

returns TRUE, on success or FALSE on failure.

print your date_create ($item)


$arr has been re-assigned by you, and you don't need to use $arr to receive the return value when using array_walk.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b41e4c-2b931.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b41e4c-2b931.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?