PHP递减循环

I have a string variable like this: '1111/222/333' or '1111/222/333/444'

and I want to get an Array like this:

111-222-3333
111-222-
111-

OR

1111-222-333-444
1111-222-333-
1111-222-
1111-

I have tried with $pieces = explode("/", $str);

and:

$str = '1111/222/333/444';
$pieces = explode("/", $str);
for($i=0; $i<count($pieces); $i++) {

    $var .= $pieces[$i]."-".$pieces[$i+1];
    echo $i." - ".$var."<br>";  

}

but I haven't gotten the correct result!

Any help?

$str = '1111/222/333/444' ;
$pieces = explode("/", $str);
$num = count($pieces);
for($i=0;$i<$num;$i++) {
        print implode('-',$pieces).($i?'-':'')."
";
        array_pop($pieces);
}

See it work

How about this:

$str = '1111/222/333/444';
$pieces = explode("/", $str);
$newArray = array();
$s = '';
foreach ($pieces as $piece)
{
    $s .= $piece.'-'
    $newArray[] = $s;
}
rsort($newArray);

My first try is:

$str = '1111/222/333/444';
$pieces = explode("/", $str);
$countPieces = count($pieces);
echo $countPieces;
while ($countPieces > 0) {
    $var = $pieces[0];
        for($i = 1; $i < $countPieces; $i++) {
            $var =  $var . "-" . $pieces[$i];
        }
    echo $var . "
";  
    $countPieces--;
}