source: branches/version-2_5-dev/data/module/Compat/tests/function/str_split.phpt @ 20116

Revision 20116, 852 bytes checked in by nanasess, 13 years ago (diff)
  • svn properties を再設定
  • 再設定用のスクリプト追加
  • Property svn:eol-style set to LF
  • Property svn:keywords set to Id
Line 
1--TEST--
2Function -- str_split
3--SKIPIF--
4<?php if (function_exists('str_split')) { echo 'skip'; } ?>
5--FILE--
6<?php
7require_once 'PHP/Compat.php';
8PHP_Compat::loadFunction('str_split');
9
10$str = "Hello Friend";
11
12// Simple
13$arr = str_split($str);
14print_r($arr);
15
16// With a chunk size specified
17$arr = str_split($str, 3);
18print_r($arr);
19
20// With chunk size bigger than the string
21$arr = str_split($str, 60);
22print_r($arr);
23
24// String that has a remainder less than the chunk size
25$arr = str_split($str, 11);
26print_r($arr);
27?>
28--EXPECT--
29Array
30(
31    [0] => H
32    [1] => e
33    [2] => l
34    [3] => l
35    [4] => o
36    [5] => 
37    [6] => F
38    [7] => r
39    [8] => i
40    [9] => e
41    [10] => n
42    [11] => d
43)
44Array
45(
46    [0] => Hel
47    [1] => lo
48    [2] => Fri
49    [3] => end
50)
51Array
52(
53    [0] => Hello Friend
54)
55Array
56(
57    [0] => Hello Frien
58    [1] => d
59)
Note: See TracBrowser for help on using the repository browser.