- var_dump: documentation ( source)
- array_reverse: documentation ( source)
<?php
$arr = ['one', 'two', 'free'];
$value = 10;
$arr = array_reverse($arr);
Foreach($arr as $key => $val){
if($key==0){
$new[$val]= $value;
}else{
$new = [$val => $new];
}
}
var_dump($new);