//インスタンスの生成
$obj = new FuncRecursive()
----------------------------------------------------------------------------------------------------------------------
//strlen
$a = array('test', array('aaabbb"&&"αβ', 'hello world'));
$r = $obj->execute('strlen', $a);
//実行結果
Array
(
[0] => 4
[1] => Array
(
[0] => 14
[1] => 11
)
)
----------------------------------------------------------------------------------------------------------------------
//strip_tags
$a = array('<h1>test</h1>', array('aaabbb"&&"αβ', '<a>hello world</a>'));
$r = $obj->execute('strip_tags', $a);
//実行結果
Array
(
[0] => test
[1] => Array
(
[0] => aaabbb"&&"αβ
[1] => hello world
)
)
----------------------------------------------------------------------------------------------------------------------
//htmlentities
$a = array('<h1>test</h1>', array('aaabbb"&&"αβ', '<a>hello world</a>'));
$r = $obj->execute('htmlentities', $a);
//実行結果
Array
(
[0] => <h1>test</h1>
[1] => Array
(
[0] => aaabbb"&&"αβ
[1] => <a>hello world</a>
)
)
----------------------------------------------------------------------------------------------------------------------
//htmlspecialchars
$a = array('<h1>test</h1>', array('aaabbb"&&"αβ', '<a>hello world</a>'));
$r = $obj->execute('htmlspecialchars', $a);
//実行結果
Array
(
[0] => <h1>test</h1>
[1] => Array
(
[0] => aaabbb"&&"αβ
[1] => <a>hello world</a>
)
)
----------------------------------------------------------------------------------------------------------------------
//mb_convert_kana
$a = array('アイウエオ','ガギグゲゴ',array('パピプペポ','フライドポテト', array('ヴァヴァヴァ')));
$r = $obj->execute('mb_convert_kana', $a, 'KV', 'UTF-8');
//実行結果
Array
(
[0] => アイウエオ
[1] => ガギグゲゴ
[2] => Array
(
[0] => パピプペポ
[1] => フライドポテト
[2] => Array
(
[0] => ヴァヴァヴァ
)
)
)
----------------------------------------------------------------------------------------------------------------------
//sampleFunc(自作の関数)
function sampleFunc($data) {
echo $data.'<br />';
}
$a = array('あいうえお','かきくけこ',array('食べられません', '冷やし中華始めませんか?'));
$r = $obj->execute('sampleFunc', $a);
//実行結果
あいうえお
かきくけこ
食べられません
冷やし中華始めませんか?
----------------------------------------------------------------------------------------------------------------------
//implode
$obj->type = 'array';
$a = array('あいうえお','かきくけこ',array('食べられません', '冷やし中華始めませんか?'));
$r = $obj->execute('implode', $a, ',');
Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php:210
Stack trace:
#0 /home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php(210): implode(Array, ',')
#1 /home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php(205): FuncRecursive->_exeArray(Array)
#2 /home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php(178): FuncRecursive->_exeArray(Array)
#3 /home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php(92): FuncRecursive->execute('implode', Array, ',')
#4 /home/normnois/norm-nois.com/public_html/reference/func_recursive/index.php(15): require('/home/normnois/...')
#5 {main}
thrown in
/home/normnois/norm-nois.com/public_html/reference/func_recursive/sample.php on line
210