|
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>
( つっこみ )
|
最近の日記 2025年12月25日 ・pbulk 11.99.3 (emacs30) 2025年11月22日 ・crash dump 2025年10月25日 ・recover from disk error 2025年10月23日 ・dd does not duplicate Windows 11 boot disk ? 2025年10月13日 ・missing package | ||