text
stringlengths 1
254
| output
stringlengths 2
255
|
---|---|
Example 1. each() examples
|
例 1 each() の例
|
$foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each ($foo);
|
$bar は、ここでは以下のキー/値のペアを保持し ています。
|
$foo = array ("Robert "= "Bob", "Seppo" = "Sepi"); $bar = each ($foo);
|
$bar は、この時点で以下のキー/値のペアを保持 しています。
|
each() is typically used in conjunction with list() to traverse an array; for instance, $_POST:
|
通常 each() は、配列の走査をす?_っk list() と共に使用されます。例えば、 $HTTP_POST_VARSの場合は次のようになります。
|
Traversing $_POST with each()
|
例 2 each() により$HTTP_POST_VARSを走査する
|
After each() has executed, the array cursor will be left on the next element of the array, or on the last element if it hits the end of the array.
|
each() を実行した後、配列カーソルは、 配列の次の要素に移動します。配列の最終要素にカーソルがある場合は、 最終要素にとどまります。eachを使用して配列を走査するには、 reset() を使用する必要があります。
|
See also key(), list(), current(), reset(), next(), prev(), and foreach.
|
key() 、 list() 、 current() 、 reset() 、 next() 、 prev() も参照下さい。
|
(PHP 3 = 3.0.9, PHP 4)
|
(PHP 3 = 3.0.9, PHP 4)
|
Since PHP 4.3.0, the year parameter is optional and defaults to the current year according to the localtime if ommited.
|
指定した年yearにおける復活祭の真夜中のUNIX時を返します。 yearが指定されない場合、現在の年が仮定されます。
|
Example 1. easter_date() example
|
警告: この関数は、指定した年がUNIX時の 範囲外(すなわち1970年以前か2037年以降)である場合に警告を 生成します。
|
The date of Easter Day was defined by the Council of Nicaea in AD325 as the Sunday after the first full moon which falls on or after the Spring Equinox.
|
例 1 easter_date() の例
|
See easter_days() for calculating Easter before 1970 or after 2037.
|
1970年以前または2037年以降の復活祭の計算に関しては、 easter_days() を参照ください。
|
If no year is specified, the current year is assumed.
|
(PHP 3 = 3.0.9, PHP 4)
|
The method parameter was also introduced in PHP 4.3.0 and allows to calculate easter dates based on the Gregorian calendar during the years 1582 - 1752 when set to CAL_EASTER_ROMAN.
|
指定した年 year において3月21日以降復活祭までの日数を返します。 year が指定されない場合、現在の年が仮定されます。
|
This function can be used instead of easter_date() to calculate Easter for years which fall outside the range of UNIX timestamps (i.e. before 1970 or after 2037).
|
この関数は、UNIX時の範囲外(すなわち1970年以前または2037年以降)の復活祭を 計算するために easter_date() の代わりにしようすることが できます。
|
April 22 * / echo easter_days (1913); / * 2, i.e.
|
例 1 easter_days() の例
|
Under the Julian Calendar (for years before 1753) a simple 19-year cycle is used to track the phases of the Moon.
|
(このコードは、Simon Kershaw, [email protected] によるCプログラムに基づくものです。)
|
See also easter_date().
|
easter_date() も参照ください。
|
(PHP 3 = 3.0.17)
|
(PHP 3 = 3.0.17)
|
It translates the EBCDIC encoded string ebcdic_str to its equivalent ASCII representation (binary safe), and returns the result.
|
ebcdic2ascii() は、EBCDICに基づくオペレーティング システム (OS/390, BS2000)でのみ使用可能なApache専用の関数です。 この関数は、EBCDICンコードされた文字列 ebcdic_str を等価なASCII表現(バイナリ対応)に 変換し、結果を返します。
|
Prev
|
逆の動作をする関数 ascii2ebcdic() も参照下さい。
|
echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it.
|
(PHP 3, PHP 4)
|
It is not possible to use echo() in a variable function context.
|
この関数は、すべてのパラメータを出力します。
|
I have ?=$foo? foo.
|
例 1 echo() の例
|
This short syntax only works with the short_open_tag configuration setting enabled.
|
echo() には、次のように開始タグのすぐ後に等号 を付ける省略形があります。
|
Prev
|
print(), printf(), flush() も参照下さい。
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
See converting to boolean for more information.
|
注意 empty() は、言語構造です。
|
Note that this is meaningless when used on anything which isn' t a variable; i.e. empty (addslashes ($name)) has no meaning since it would be checking whether something which isn't a variable is a variable with a FALSE value.
|
この関数は、変数が設定されていない場合に警告は生成されないこと以 外は、 (boolean) var の逆 です。より詳細な情報については、 論理値への変換 を 参照下さい。
|
See also isset() and unset().
|
変数でないものに使用しても意味がないことに注意して下さい。すなわ ち、 empty( addslashes( $name)) は変数でないも のに対して FALSE 値を持つ変数であるかどうかを調べているため意味が ありません。
|
doubleval
|
isset() および unset() も参 照下さい。
|
Prev
|
(PHP 3, PHP 4)
|
end() advances array's internal pointer to the last element, and returns that element.
|
end() は array の内部ポイ ンタを最後の要素まで進め、その要素を返します。
|
See also current(), each(), next(), and reset().
|
current(), each(), next(), reset() も参照下さい。
|
Prev
|
(PHP 3, PHP 4)
|
Searches a string for matches to the regular expression given in pattern.
|
この関数は、 pattern で指定した正規表現 により string を検索します。
|
Note:
|
pattern の括弧でくくられた部分文字列に マッチし、かつこの関数が3番目の引数 regs を指定 してコールされた場合、マッチした部分が配列 regs に格納されます。$regs[1]は最初の左括弧が始まる部分文字列を保持、 $regs[2]は二番目の左括弧が始まる部分文字列を保持、...、 といったようになっています。$regs[0]は string のコピーを保持しています。
|
This has no effect on ereg() 's ability to match more substrings.
|
注意 PHP 4.1.0より前のバージョンでは、 $regs にはちょ うど10個の要素が代入されました。これは、実際にマッチした括弧付き のサブ文字列が10より多くても少なくても同じでした。ただし、 ereg() にはより多くの部分文字列にマッチする能 力があります。マッチするものが見付からなかった場合、 $regs は、 ereg() により書き 換えられません。
|
Searching is case sensitive.
|
検索においては、大文字と小文字を区別します。
|
The following code snippet takes a date in ISO format (YYYY-MM-DD) and prints it in DD.MM.YYYY format:
|
string の中で pattern がマッチすると TRUE を返し、マッチしなかった場合またはエラーとなっ た場合は FALSE を返します。
|
See also eregi(), ereg_replace(), eregi_replace(), and preg_match().
|
以下のサンプルコードは、ISOフォーマット(YYYY-MM-DD)で格納 されている日付をDD.MM.YYYYフォーマットで表示するものです。
|
Home
|
例 1 ereg() の例
|
ereg_replace
|
eregi(), ereg_replace(), eregi_replace(), preg_match() も参照下さい。
|
Prev
|
(PHP 3, PHP 4)
|
This function is identical to ereg() except that this ignores case distinction when matching alphabetic characters.
|
この関数は、アルファベット文字をマッチングさせる際に 大文字小文字の区別をしないこと以外は ereg() と同 じです。
|
if (eregi("z", $string)) {echo "'$string 'contains a'z' or'Z' !";}
|
例 1 eregi() の例
|
Prev
|
ereg(), ereg_replace(), eregi_replace() も参照下さい。
|
Prev
|
(PHP 3, PHP 4)
|
This function is identical to ereg_replace() except that this ignores case distinction when matching alphabetic characters.
|
この関数は、アルファベット文字をマッチングさせる際に大文字 小文字の区別をしないこと以外は ereg_replace() と 同じです。
|
Prev
|
ereg(), eregi() および ereg_replace() も参照下さい。
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
The modified string is returned. (Which may mean that the original string is returned if there are no matches to be replaced.)
|
注意 Perl互換の正規表現構文を使用する preg_replace() は、しばしば ereg_replace() よりも速い代替関数です。
|
If no matches are found in string, then string will be returned unchanged.
|
この関数は、 string をスキャンして pattern にマッチするものを探し、 マッチしたテキストを replacement で置換します。
|
Example 1. ereg_replace() Example
|
置換後の文字列が返されます。(マッチしなかった場合は、 元の文字列が返されます。)
|
One thing to take note of is that if you use an integer value as the replacement One thing to take note of is that if you use an integer value as the replacement parameter, you may not get the results you expect.
|
pattern の中に括弧でくくられた部分 文字列が含まれている場合、 replacement の中に\\ 数字 のような部分文字列を埋め込むこともできます。この部分は、 「数字」番目の括弧でくくられた部分文字列にマッチする文字列 に置き換えられます。また、 \\0 は文字列全体 を指します。9個までの部分文字列を使うことができます。括弧は 入れ子になっていても構いません。この場合は開き括弧 '(' が 最大9個まで使用可能です。
|
This is because ereg_replace() will interpret the number as the ordinal value of a character, and apply that.
|
string においてマッチするものがなかった 場合、 string は変更されずに返されます。
|
Example 2. ereg_replace() Example
|
たとえば、以下のサンプルコードは"This was a test" と3回表示します。
|
Replace URLs with links
|
例 1 ereg_replace() の例
|
See also ereg(), eregi(), eregi_replace(), str_replace(), and preg_match().
|
注意しなければならないのは、パラメータ replacement として整数値を使用する場合、 期待する結果が得られない可能性があります。これは、 ereg_replace() が文字の値を数値として解釈し、 使用するためです。例えば、次のようになります。
|
Home
|
例 2 ereg_replace() の例
|
Regular Expression Functions (POSIX Extended)
|
例 3URLをリンクで置換する
|
ereg
|
ereg(), eregi(), eregi_replace(), str_replace(), preg_match() も参照下さい。
|
The first parameter, message, is the error message that should be logged.
|
(PHP 3, PHP 4)
|
message is sent to PHP' s system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to.
|
エラーメッセージを Web サーバのエラーログ、 TCP ポート、ファイルのいずれかに送ります。 最初のパラメータ message はログされる メッセージです。2 番目のパラメータ message_type はメッセージをどこへ送るのかを指定します。
|
This is the only message type where the fourth parameter, extra_headers is used.
|
表 1 error_log() ログタイプ
|
In this case, the destination parameter specifies the host name or IP address and optionally, port number, of the socket receiving the debug information.
|
TCP/IP経由でのリモートデバッグは、PHP 3の機能であり、PHP 4では利 用できません。
|
Example 1. error_log() examples
|
例 1 error_log() の例
|
As error levels are added, the range of integers increases, so older integer-based error levels will not always behave as expected.
|
(PHP 3, PHP 4)
|
The actual meanings of these error levels are described in the predefined constants.
|
例 1エラー整数の変更
|
value
|
表 1 error_reporting() ビット値
|
Prev
|
例 2 error_reporting() の例
|
(PHP 4 = 4.0.3)
|
(PHP 4 = 4.0.3)
|
This function should be used to escape individual arguments to shell functions coming from user input.
|
escapeshellarg() は、文字列をシングルクオート で括り、既存のシングルクオートを全てクオート/エスケープします。こ れにより、文字列を直接シェル関数に渡し、単一の安全な引数として処 理することを可能にします。この関数は、ユーザー入力からの入力を シェル関数への引数として渡す際にエスケープするために使用する必要 があります。シェル関数には、 exec(), system() そして 実行演算子 を含むシェル関数が含まれます。 標準的な使用法は次のようになります。
|
See also exec(), popen(), system(), and the backtick operator.
|
exec(), popen(), system() および 実行演算子 も参照下さい。
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
This function should be used to make sure that any data coming from user input is escaped before this data is passed to the exec() or system() functions, or to the backtick operator.
|
escapeshellcmd() は、文字列中においてシェルコマ ンドをだまして勝手なコマンドを実行する可能性がある文字をエスケー プします。この関数は、ユーザに入力されたデータを関数 exec() または system() または、 backtick 演算子 に渡す前に全てエスケープを行う場合に使用するべきです。 標準的な使い方は以下のようになるでしょう。
|
Prev
|
escapeshellarg(), exec(), popen(), system(), backtick 演算子 も参照下さい。
|
(PHP 3, PHP 4)
|
(PHP 3, PHP 4)
|
Among other things, this can be useful for storing code in a database text field for later execution.
|
eval() は、 code_str で与えられた文字列を PHP コードとして評価します。 中でも、データベースのテキストフィールドにコードを保存し、 後で実行するためには便利です。
|
Remember that the string passed must be valid PHP code, including things like terminating statements with a semicolon so the parser doesn' t die on the line after the eval(), and properly escaping things in code_str.
|
eval() を使用する際、注意するべき点が いくつかあります。 パーサーが eval() の処理中に落ちないように、 渡す文字列はセミコロンで文が終了するといった有効なPHPコード である必要があります。また、 code_str の 中の文字を適切にエスケープする必要があります。
|
A return statement will terminate the evaluation of the string immediately.
|
eval() の中で値を与えた変数は、 この後、メインスクリプトの中でもこれらの値を維持することも 覚えておいて下さい。
|
In PHP 3, eval() does not return a value.
|
return 文は、文字列の評価をただちに終了します。 PHP4では、 eval() 関数は FALSE を返します。さも なくば、結果の値を返すために return を使用するこ とが可能です。一方、PHP3では、 eval() の型は void であり、値を何も返しません。
|
?php $string = 'cup'; $name = 'coffee'; $str = 'This is a $string with my $name in it. br'; echo $str; eval ("\$str = \"$str\" ;"); echo $str;?
|
例 1 eval() の例 - 簡単なテキストのマージ
|
This is a cup with my coffee in it.
|
上の例は、以下を表示します。
|
Prev
|
ティップ ブラウザに直接結果を出力する全てのものと同様に、 出力制御関数 を使用してこの関数の出力をキャプチャーし、文字列等に保存することが可能です。
|
It simply returns the last line from the result of the command.
|
(PHP 3, PHP 4)
|
If the array argument is present, then the specified array will be filled with every line of output from the command.
|
exec() は指定された command を実行しますが、一切の出力はありま せん。ただ単に、コマンド結果の最後の行を返すだけです。コマンドを実行 し、一切干渉を受けずに直接コマンドから全てのデータを受けとる必要が あるならば、 PassThru() 関数を使ってください。
|
If the return_var argument is present along with the array argument, then the return status of the executed command will be written to this variable.
|
引数 array が存在する場合、指定した配列は、 コマンドからの出力の各行で埋められます。配列に既に何らかの要素が 含まれる場合は、 exec() は配列の最後に追加される ことに注意してください。関数が要素を追加することを望まないのなら、 それが exec() に渡される前に、配列の unset() を呼び出してください。 引数 return_var が、引数 array と共に存在する場合、実行したコマンドの ステータスがこの変数に書かれます。
|
If you are going to allow data coming from user input to be passed to this function, then you should be using escapeshellarg() or escapeshellcmd() to make sure that users cannot trick the system into executing arbitrary commands.
|
ユーザ入力によるデータを、この関数に渡すことを許可したいのであれば、 ユーザがシステムをだまして勝手なコマンドを実行できないように、 escapeshellcmd() を使うべきです。
|
Prev
|
system(), passthru(), popen(), escapeshellcmd(), backtick 演算子 も参照ください。
|
exif_imagetype() reads the first bytes of an image and checks its signature.
|
(PHP 4 = 4.3.0)
|
The return value is the same value that getimagesize() returns in index 2 but this function is much faster.
|
exif_imagetype() はイメージの先頭バイトを読み、そ のサインを調べます。正しいサインがみつかった場合は定数が返され、そ の他の場合は、 FALSE が返されます。返り値は getimagesize() が添字2に返す値と同じですが、この 関数はずっとはやく動作します。
|
Note:
|
この関数は、他のexif関数がサポートされていないファイル型式でコール されるのを防止したり、$_SERVER['HTTP_ACCEPT']と組み合わせて、 イメージを見る人がブラウザに特定のイメージを見ることができるかどう かを調べるために使用可能です。
|
This function does not require the GD image library.
|
注意 この関数は、 --enable-exif を指定 してPHP 4がコンパイルされている場合のみ利用可能です。
|
Prev
|
この関数は、GDイメージライブラリを必要としません。
|
Image functions
|
getimagesize() も参照ください。
|
(PHP 4 = 4.2.0)
|
(PHP 4 = 4.2.0)
|
It returns an associative array where the indexes are the header names and the values are the values associated with those headers.
|
関数 exif_read_data() はJPEGまたはTIFFイメージファ イルからEXIFヘッダを読みこみます。この関数は、キーがヘッダ名、値 がヘッダに関連するの値となる連想配列を返します。返すデータがない 場合、 FALSE が返されます。
|
sections a comma separated list of sections that need to be present in file to produce a result array.
|
filename は読みこむファイル名です。これは、 URLとして使用することはできません。
|
All tagged information about the embedded thumbnail is stored in this section.
|
sections は、結果の配列を生成する際に含める カンマ区切りのセクションのリストです。
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.