Move Value in PHP Array to the Beginning of the Array

前端 未结 12 1385
终归单人心
终归单人心 2020-12-10 02:52

I have a PHP array similar to this:

0 => \"red\",
1 => \"green\",
2 => \"blue\",
3 => \"yellow\"

I want to move yellow to index

12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 03:32

    $a = array('red','green', 'blue','yellow');
    
    $b = array_reverse( $a );
    

    If your question is how to make the last become the first.

提交回复
热议问题