|
Namazu for hns による簡易全文検索 詳しくは 詳細指定/ヘルプを参照して下さい |
||||||||||||||||||||||||||||||||||||||||||||||||
2006年03月20日(月) 旧暦 [n年日記] [更新:"2006/03/21 16:02:50"]#1 [php] php で decode 済の配列を生成する
ちょっとこのような定数の配列が欲しかったので、作ってみた。
<!-- -*- PHP -*- --> <html> <head> <link rel=stylesheet href="./.css"> <title>ようこそ </title> </head> <body> <?php // SEE -> http://php.s3.to/man/control-structures.while.html ///// --------------------------------------------------------- ///// G E N E R A T E decoded pattern as shown below ///// 以下 7 行は下に書いたような模様を生成します $i = 0; while ( $i <= 7){ $pattern[$i] = array ('selected'); $j = 0; while ( $j < $i ) { array_unshift($pattern[$i], " "); $j++; } $i++;} ///// following is just a debug (to generate printed pattern, normally not used) ///// 以下 3 行は、上で作ったものを確認するためのもので、通常は必要ありません。 foreach ($pattern as $i) { print " $i[0], $i[1], $i[2], $i[3], $i[4], $i[5], $i[6], $i[7]<br>\n"; } ///// R E S U L T S (8 lines) ///// selected, , , , , , , ///// , selected, , , , , , ///// , , selected, , , , , ///// , , , selected, , , , ///// , , , , selected, , , ///// , , , , , selected, , ///// , , , , , , selected, ///// , , , , , , , selected ///// --------------------------------------------------------- ///// 利用方法としては、 $hoge = $pattern[0]; // のように選択すれば、次のような一式に代入されます。 print " $hoge[0], $hoge[1], $hoge[2], $hoge[3], $hoge[4], $hoge[5], $hoge[6], $hoge[7]<br>\n"; ?> </body> </html> ( つっこみ )
|
最近の日記 2024年05月08日 ・comparison on ./buildsh tools 2024年05月06日 ・py-setuptools (python 3.11.9) ・make release took 1 hours and 10 min ・qemu invocation for 10.99.10 2024年05月05日 ・Windows 10 version ・serial connection ・bc bench 2024年05月04日 ・Trial on 10.99.10 ・another version (later trial) to succeed 2024年04月29日 ・dkim | ||