text
stringlengths
1
254
output
stringlengths
2
255
Its opperation is equivalent to that of the socket_select() function except in that it acts on streams.
The stream_select() function accepts arrays of streams and waits for them to change status. Its opperation is equivalent to that of the socket_select() function except in that it acts on streams.
Warning
The streams listed in the write array will be watched to see if a write will not block.
You do not need to pass every array to stream_select().
The streams listed in the except array will be watched for exceptions.
Also do not forget that those arrays are passed by reference and will be modified after stream_select() returns.
On exit, the arrays are modified to indicate which stream resource actually changed status.
Note:
Example:
On success stream_select() On success stream_select() returns the number of stream resorces contained in the modified arrays, which may be zero if the timeout expires before anything interesting happens.
On success stream_select() returns the number of stream resorces contained in the modified arrays, which may be zero if the timeout expires before anything interesting happens. On error FALSE is returned.
if (false === stream_select($r, $w, $e = NULL, 0)) {echo "stream_select() failed\n";}
注意 Be sure to use the === operator when checking for an error. Since the stream_select() may return 0 the comparison with == would evaluate to TRUE:
A few basic rules:
注意 Be aware that some stream implementations need to be handled very carefully. A few basic rules:
Your program should have nothing to do if there is no data available.
You should always try to use stream_select() without timeout. Your program should have nothing to do if there is no data available. Code that depends on timeouts is not usually portable and difficult to debug.
If you read / write to a stream returned in the arrays be aware that they do not necessarily read / write the full amount of data you have requested.
If you read/write to a stream returned in the arrays be aware that they do not necessarily read/write the full amount of data you have requested. Be prepared to even only be able to read/write a single byte.
See also stream_set_blocking()
See also stream_set_blocking()
(PHP 4 = 4.3.0)
(PHP 4 = 4.3.0)
This function was previously called as set_socket_blocking() and later socket_set_blocking() but this usage is deprecated.
This function was previously called as set_socket_blocking() and later socket_set_blocking() but this usage is deprecated.
Since PHP 4.3, this function works for any stream that supports non-blocking mode (currently, regular files and socket streams).
注意 Prior to PHP 4.3, this function only worked on socket based streams. Since PHP 4.3, this function works for any stream that supports non-blocking mode (currently, regular files and socket streams).
Prev
(PHP 4 = 4.3.0)
Sets the timeout value on stream, expressed in the sum of seconds and microseconds.
Sets the timeout value on stream, expressed in the sum of seconds and microseconds.
Example 1. stream_set_timeout() Example
例 1 stream_set_timeout() Example
Note:
注意 As of PHP 4.3, this function can (potentially) work on any kind of stream. In PHP 4.3, socket based streams are still the only kind supported in the PHP core, although streams from other extensions may support this function.
In PHP 4.3, socket based streams are still the only kind supported in the PHP core, although streams from other extensions may support this function.
This function was previously called as set_socket_timeout() and later socket_set_timeout() but this usage is deprecated.
See also: fsockopen() and fopen().
See also: fsockopen() and fopen().
(PHP 4 = 4.3.0)
(PHP 4 = 4.3.0)
This ensures that all writes with fwrite() are completed before other processes are allowed to write to that output stream.
The function returns 0 on success, or EOF if the request cannot be honored.
The following example demonstrates how to use stream_set_write_buffer() to create an unbuffered stream.
The following example demonstrates how to use stream_set_write_buffer() to create an unbuffered stream.
$fp = fopen( $file, "w"); if ($fp) {stream_set_write_buffer($fp, 0); fputs($fp, $output); fclose($fp);}
例 1 stream_set_write_buffer() example
Prev
See also fopen() and fwrite().
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Month and weekday names and other language dependent strings respect the current locale set with setlocale().
指定した timestamp または timestamp が指定されていない場合に現在のローカル時間を用いて指定した フォーマット文字列に基づき文字列をフォーマットして返します。 月および曜日の名前およびその他の言語依存の文字列は、 setlocale() でセットされた現在のロケールに関係 します。
%a - abbreviated weekday name according to the current locale
次の変換指定子は、フォーマット文字列として認識されます。
%b - abbreviated month name according to the current locale
%a - 現在のロケールに基づく短縮された曜日の名前
%c - preferred date and time representation for the current locale
%A - 現在のロケールに基づく完全な曜日の名前
%d - day of the month as a decimal number (range 01 to 31)
%b - 現在のロケールに基づく短縮された月の名前
%e - day of the month as a decimal number, a single digit is preceded by a space (range '1' to '31')
%B - 現在のロケールに基づく完全な月の名前
%G - The 4-digit year corresponding to the ISO week number (see %V).
%c - 現在のロケールに基づく適当な日付と時間の表現
This has the same format and value as %Y, except that if the ISO week number belongs to the previous or next year, that year is used instead.
%C - 世紀(年を100で割り、整数に丸めたもの。00〜99)
%H - hour as a decimal number using a 24-hour clock (range 00 to 23)
%d - 日付を10進数で。(01から31)
%I - hour as a decimal number using a 12-hour clock (range 01 to 12)
%D - %m/%d/%yと同じ
%m - month as a decimal number (range 01 to 12)
%e - 月単位の日付を10進数で表したもの。日付が1桁の場合は、前に 空白を一つ付けます。(' 1'〜'31')
%n - newline character
%h - %bと同じ。
%r - time in a.m. and p.m. notation
%H - 時間を24時間表示の10進数で(00から23まで)
%S - second as a decimal number
%I - 時間を12時間表示の10進数で(01から12までの範囲)
%T - current time, equal to %H:%M:%S
%j - 年間での日付を10進数で表現 (001から366)
Warning
%m - 月を10進数で表現 (01から12)
Sun Solaris seems to start with Sunday as 1 although ISO 9889:1999 (the current C standard) clearly specifies that it should be Monday.
%M - 分を10進数で表現
%w - day of the week as a decimal, Sunday being 0
%p - 指定した時間により `am' または `pm' 、または 現在のロケールに対応した文字列
%x - preferred date representation for the current locale without the time
%r - a.m.およびp.m.表記で表した時間
%X - preferred time representation for the current locale without the date
%R - 24時間表記で表した時間
%y - year as a decimal number without a century (range 00 to 99)
%S - 秒を10進数で表現
%Y - year as a decimal number including the century
%t - タブ文字
%Z - time zone or name or abbreviation
%T - 現在の時間。%H:%M:%Sに等しい。
Note:
%u - 10進数表記の曜日で1〜7の範囲。1が月曜日。
This means that e.g. %e, %T, %R and %D (there might be more) will not work on Windows.
%U - 年間で何番目の週であるかを 10 進数で表現。 年間で最初の日曜を最初の週の最初の日として数えます。
See %V above and example below.
%W - 現在の年で何番目の週であるかを10進数で表現。 年間で最初の月曜を最初の週の最初の日として数えます。
ISO 8601:1988 week number example
%w - 曜日を10進数で表現。日曜は0になります。
?php / * December 2002 / January 2003 ISOWk M Tu W Thu F Sa Su ---- - --------------------------- - 51 16 17 18 19 20 21 22 52 23 24 25 26 27 28 29 1 30 31 1 2 3 4 5 2 6 7 8 9 10 11 12 3 13 14 15 16 17 18 19 * / / / Outputs:
%x - 時間を除いた日付を現在のロケールに基づき表現します。
12 / 28 / 2002 - %V,%G,%Y = 52,2002,2002 print "12 / 28 / 2002 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("12 / 28 / 2002")). "\n"; / / Outputs:
%X - 日付を除いた時間を現在のロケールに基づき表現します。
12 / 30 / 2002 - %V,%G,%Y = 1,2003,2002 print "12 / 30 / 2002 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("12 / 30 / 2002")). "\n"; / / Outputs:
%y - 世紀の部分を除いた年を10進数として表現。(00から99までの範囲)
1 / 3/2003 - %V,%G,%Y = 1,2003,2003 print "1 / 3/2003 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("1 / 3/2003")). "\n"; / / Outputs:
%Z - タイムゾーンまたはその名前または短縮形
12 / 23 / 2004 - %V,%G,%Y = 52,2004,2004 print "12 / 23 / 2004 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("12 / 23 / 2004")). "\n"; / / Outputs:
%% - 文字リテラル`%'
1 / 2/2005 - %V,%G,%Y = 53,2004,2005 print "1 / 2/2005 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("1 / 2/2005")). "\n"; / / Outputs:
注意 (上記の)全ての変換指定子が使用するCライブラリでサポートされてい ない可能性があります。この場合、PHPの strftime() で該当する変換指定子はサポートされ ません。
1 / 3/2005 - %V,%G,%Y = 1,2005,2005 print "1 / 3/2005 - %V,%G,%Y =". strftime("%V,%G,%Y",strtotime("1 / 3/2005")). "\n";?
例 1 strftime() の例
Prev
setlocale() 、 mktime() 、 Open Groupによる strftime() の定義 も参照下さい。
(PHP 4)
(PHP 4)
Recognizes C-like \n, \r..., octal and hexadecimal representation.
バックスラッシュを取り除いた文字列を返します。C言語と同様に \n, \r..., 8進表現, 16進表 現を認識します。
Prev
addcslashes() も参照下さい。
Prev
(PHP 3, PHP 4)
Returns a string with backslashes stripped off. (\ 'becomes' and so on.) Double backslashes are made into a single backslash.
バックスラッシュが取り除かれた文字列を返します。( \' が 'になるなど) 2つ並んだバックスラッシュは1つのバックスラッシュになります。
Prev
addslashes() も参照下さい。
(PHP 3 = 3.0.8, PHP 4)
(PHP 3 = 3.0.8, PHP 4)
It errors on the side of caution in case of incomplete or bogus tags.
この関数は、指定した文字列から全てのHTMLおよびPHPタグを取り除きま す。不完全あるいは間違ったタグの場合は、エラーとなり警告を発生し ます。この関数は、 fgetss() 関数と同じタグ除去 アルゴリズムを使用します。
You can use the optional second parameter to specify tags which should not be stripped.
オプションの2番目の引数により、取り除かないタグを指定できます。
Example 1. strip_tags() example
注意 allowable_tags は、PHP3.0.13,PHP4B3で追加 されました。
Warning
例 1 strip_tags() の例
stripcslashes
この関数は、 allowable_tags で許可したタグ の属性を全く修整しません。これには、 style お よび onmouseover 属性が含まれており、悪意のあ るユーザが他のユーザに見せるようなテキストを投稿する際に危険な行 為を行う可能性があります。
Prev
(PHP 3 = 3.0.6, PHP 4)
Returns all of haystack from the first occurrence of needle to the end. needle and haystack are examined in a case-insensitive manner.
haystack において needle が最初に見つかった位置から最後までを 返します。 needle および haystack は大文字小文字を区別せずに評価されます。
If needle is not a string, it is converted to an integer and applied as the ordinal value of a character.
needle がない場合、 FALSE を返します。
Prev
needle が文字列でない場合、整数に変換され、 通常の文字列として適用されます。
stripslashes
strchr(), strrchr(), substr(), ereg() も参照下さい。
(PHP 3, PHP 4)
(PHP 3, PHP 4)
Prev
string の長さを返します。
(PHP 4)
(PHP 4)
The behaviour of this function is similar to strnatcmp(), except that the comparison is not case sensitive.
この関数は、人間が行うような手法でアルファベットまたは数字の文字 列の順序を比較するアルゴリズムを実装します。この関数の動作は、 strnatcmp() に似ていますが、比較が大文字小文字 を区別しない違いがあります。詳細な情報については、Martin Poolの Natural Order String Comparison のページを参照下さい。
Similar to other string comparison functions, this one returns 0 if str1 is less than str2; 0 if str1 is greater than str2, and 0 if they are equal.
他の文字列比較関数と同様に、この関数は、 str1 が str2 より小さ いに場合に 0、 str1 が str2 より大きい場合に 0 、等しい場合に 0 を返します。
Prev
ereg(), strcasecmp(), substr(), stristr(), strcmp(), strncmp(), strncasecmp(), strnatcmp(), strstr() も参照下さい。
(PHP 4)
(PHP 4)
An example of the difference between this algorithm and the regular computer string sorting algorithms (used in strcmp()) can be seen below:
この関数は、人間が行うような手法でアルファベットまたは数字の文字 列の順序を比較するアルゴリズムを実装します。この手法は、"自然順" h言われます。このアルゴリズムと( strcmp() を使 用した)通常のコンピュータ文字列ソートの間の違いの例を次に示します。
Standard string comparison Array ([0] = img1.png [1] = img10.png [2] = img12.png [3] = img2.png) Natural order string comparison Array ([0] = img1.png [1] = img2.png [2] = img10.png [3] = img12.png)
他の文字列比較関数と同様に、この関数は、 str1 が str2 より小さ いに場合に 0、 str1 が str2 より大きい場合に 0 、等しい場合に 0返します。
Note that this comparison is case sensitive.
この比較は、大文字小文字を区別することに注意して下さい。
Prev
ereg(), strcasecmp(), substr(), stristr(), strcmp(), strncmp(), strncasecmp(), strnatcasecmp(), strstr(), natsort(), natcasesort() も参照下さい。
Prev
(PHP 4 = 4.0.2)
This function is similar to strcasecmp(), with the difference that you can specify the (upper limit of the) number of characters (len) from each string to be used in the comparison.
この関数は、 strcasecmp() に似ていますが、各文 字列から比較する文字数(の上限)( len )を指定 できるという違いがあります。どちらかの文字列が len より短い場合、その文字列の長さが比較時 に使用されます。
Returns 0 if str1 is less than str2; 0 if str1 is greater than str2, and 0 if they are equal.
str1 が str2 より短 い場合に 0 を返し、 str1 が str2 より大きい場合に 0、等しい場合に 0を返します。
Prev
ereg(), strcasecmp(), strcmp(), substr(), stristr(), strstr() も参照 下さい。
(PHP 4)
(PHP 4)
If any of the strings is shorter than len, then the length of that string will be used for the comparison.
この関数は、 strcmp() に似てますが、 各文字列から(最大)文字数( len )を比較に使用 するところが異なります。文字列長が len より も短い場合、その文字列の長さが比較に使用されます。
Note that this comparison is case sensitive.
str1 が str2 より小さ いに場合? 0、 str1 が str2 より大きい場合に 0 、等しい場合に 0 を返します。
Prev
比較は大文字小文字を区別することに注意して下さい。
strncasecmp
ereg(), strcasecmp(), substr(), stristr(), strcmp(), strstr() も参照下さい。
(PHP 4 = 4.0.1)
(PHP 4 = 4.0.1)
If the optional argument pad_string is not supplied, the input is padded with spaces, otherwise it is padded with characters from pad_string up to the limit.
この関数は文字列 input の左、右または両側を 指定した長さで埋めます。オプションの引数 pad_string が指定されていない場合は、 input は空白で埋められ、それ以外の場合は、 pad_string からの文字で制限まで埋められます。