- var_dump: documentation ( source)
- array_reduce: documentation ( source)
- array_reverse: documentation ( source)
- explode: documentation ( source)
<?php
$string = "a-b-c";
$val = "something";
$result = array_reduce(
array_reverse(explode('-', $string)),
function ($val, $key) { return array($key => $val); },
$val
);
var_dump($result);