[ create a new paste ] login | about

Link: http://codepad.org/Hc6mexm7    [ raw code | output | fork ]

PHP, pasted on Nov 3:
1
2
3
4
5
6
7
8
9
<?php

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


Output:
1
2
3
4
1111-222-333-444
1111-222-333-
1111-222-
1111-


Create a new paste based on this one


Comments: