[ create a new paste ] login | about

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

PHP, pasted on Mar 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?php

$str = "abcdef";
$len = strlen($str);

$arr = array();
for($count = 0; $count < ($len - 1); $count++)
{
    $arr[] = $str[$count].$str[$count+1];
}

print_r($arr);

?>


Output:
1
2
3
4
5
6
7
8
Array
(
    [0] => ab
    [1] => bc
    [2] => cd
    [3] => de
    [4] => ef
)


Create a new paste based on this one


Comments: