« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 57 for return match (0.003 sec.)
return (931), match (192)
match | PHP 8.3 14582
match (PHP 8) match 式は、値の一致をチェックした結果に基づいて評価結果を分岐します。 switch 文と似ていますが、 match 式は複数の候補と比較される制約式を持ちます。 switch 文とは異なり、 三項演算子のように値を評価します。 switch 文とは異なり、 ... 弱い比較( == )ではなく、 型と値の一致チェック( === ) に基づいて行われます。 match 式は PHP 8.0.0 以降で利用可能です。 例1 match 式の構造 <?php $return_value = match ( 制約式 ) { 単一の条件式 => 返却式 , 条 ... 件式1 , 条件式2 => 返却式 , }; 例2 基本的な match 式の使い方 <?php $food = 'cake' ; $return_value = match ( $food ) { 'apple' => 'This food is an apple' , 'bar' => 'This fo ... od is a bar' , 'cake' => 'This food is a cake' , }; var_dump ( $return_value ); 上の例の出力は以下となります。 string(19) "This food is a cake" 例3 比較演算子と match 式を一緒に使う例 <?php $ag ...
https://man.mtool.work/php/8.3/control-structures.match.html
Parle pattern matching | PHP 8.3 11999
Parle pattern matching Parle supports regex matching similar to flex. Also supported are the following POSIX character sets: [:alnum:] , [:alpha:] , [:blank:] , [:cntrl:] , [:digit:] , [:graph:] , [:lower:] , [:print:] , [:punct:] , [:space ... arle-utf32 to make them available. A particular encoding can be mapped with a correctly constructed regex. For example, to match the EURO symbol encoded in UTF-8, the regular expression [\xe2][\x82][\xac] can be used. The pattern for an UTF-8 encoded ... racter representations Sequence Description \a Alert (bell). \b Backspace. \e ESC character, \x1b. \n Newline. \r Carriage return. \f Form feed, \x0c. \t Horizontal tab, \x09. \v Vertical tab, \x0b. \oct Character specified by a three-digit octal code. ... ion and repetition Alternation and repetition Sequence Greedy Description ...|... - Try sub-patterns in alternation. * yes Match 0 or more times. + yes Match 1 or more times. ? yes Match 0 or 1 times. {n} no Match exactly n times. {n,} yes Match at le ...
https://man.mtool.work/php/8.3/parle.pattern.matching.html
例 | PHP 8.3 9851
例 rar:// ラッパー の例も参照ください。 例1 オンザフライでの復元 <?php if (! array_key_exists ( "i" , $_GET ) || ! is_numeric ( $_GET [ "i" ])) die( "Index unspecified or non-numeric" ); $index = (int) $_GET [ "i" ]; $arch = RarArchive :: o ... onger needed; stream is independent function detectUserAgent () { if (! array_key_exists ( 'HTTP_USER_AGENT' , $_SERVER )) return "Other" ; $uas = $_SERVER [ 'HTTP_USER_AGENT' ]; if ( preg_match ( "@Opera/@" , $uas )) return "Opera" ; if ( preg_match ( ... "@Firefox/@" , $uas )) return "Firefox" ; if ( preg_match ( "@Chrome/@" , $uas )) return "Chrome" ; if ( preg_match ( "@MSIE ([0-9.]+);@" , $uas , $matc ... hes )) { if (((float) $matches [ 1 ]) >= 7.0 ) return "IE" ; } return "Other" ; } /* * We have 3 options: * - For FF and Opera, which support RFC 2231, ...
https://man.mtool.work/php/8.3/rar.examples.html
列挙型とメソッド | PHP 8.3 9572
列挙型とメソッド 列挙型では、(Pure Enum と Backed Enum ともに) メソッドを含めることもできますし、 インターフェイスを実装することもできます。 列挙型がインターフェイスを実装する場合、 そのインターフェイスでの型チェックは、 実装した列挙型の全て ... case Diamonds ; case Clubs ; case Spades ; // インターフェイスの規約を満たすための実装 public function color (): string { return match ( $this ) { Suit :: Hearts , Suit :: Diamonds => 'Red' , Suit :: Clubs , Suit :: Spades => 'Black' , }; } // インター ... フェイスの一部ではないが、正しいコード public function shape (): string { return "Rectangle" ; } } function paint ( Colorful $c ) { print $c -> color () . "\n" ; } paint ( Suit :: Clubs ); // 動作します ... se Clubs = 'C' ; case Spades = 'S' ; // インターフェイスの規約を満たすための実装 public function color (): string { return match ( $this ) { Suit :: Hearts , Suit :: Diamonds => 'Red' , Suit :: Clubs , Suit :: Spades => 'Black' , }; } } メソッドの内部 ...
https://man.mtool.work/php/8.3/language.enumerations.methods.html
Deprecated Features | PHP 8.3 9295
Deprecated Features PHP Core Using "namespace" as a class constant name Declaring a class constant named namespace is now deprecated. namespace is a semi-reserved keyword, and the name is being reserved for possible future syntax such as a ... ass . Methods and static properties named namespace are not affected. Rename the constant, for example to NAMESPACE_NAME . Returning from a finally block Using the return statement inside a finally block is now deprecated, and emits a compile-time depr ... ecation notice. Such a return silently discards an exception thrown by, or overwrites the value returned from, the associated try or catch block, so fai ... laration. The names are being reserved as keywords for potential future features: let for block scoping and is for pattern matching. Rename the affected symbols. The deprecation of _ as a class name in PHP 8.4 is extended to constants: declaring a con ...
https://man.mtool.work/php/8.3/migration86.deprecated.html
定義済み定数 | PHP 8.3 9196
定義済み定数 以下の定数が定義されています。 この関数の拡張モジュールが PHP 組み込みでコンパイルされているか、 実行時に動的にロードされている場合のみ使用可能です。 Return values. Always check GearmanClient::error() or GearmanWorker() for a s ... AN_ERRNO ( int ) A system error. Check GearmanClient::errno() or GearmanWorker::errno() for the system error code that was returned. GEARMAN_NO_ACTIVE_FDS ( int ) GearmanClient::wait() or GearmanWorker() was called with no connections. GEARMAN_UNEXPECT ... omething went wrong in the Gearman server and it could not handle the request gracefully. GEARMAN_WORK_DATA ( int ) Notice return code obtained with GearmanClient::returnCode() when using GearmanClient::do() . Sent to update the client with data from a ... jobs. GEARMAN_ECHO_DATA_CORRUPTION ( int ) After GearmanClient::echo() or GearmanWorker::echo() the data returned doesn't match the data sent. GEARMAN_NEED_WORKLOAD_FN ( int ) When the client opted to stream the workload of a task, but did not specif ...
https://man.mtool.work/php/8.3/gearman.constants.html
XML 外部エンティティの例 | PHP 8.3 9014
XML 外部エンティティの例 この例は、XML コードに焦点を当てます。この例は、他のドキュメント をインクルードし処理するための外部エンティティリファレンスのハン ドラの使用法およびPIの処理方法、PIが含むコードに関する"信頼度" を定義する手段を説明し ... の例 <?php $file = "xmltest.xml" ; function trustedFile ( $file ) { // only trust local files owned by ourselves if (! preg_match ( "@^([a-z][a-z0-9+.-]*)\:\/\/@i" , $file ) && fileowner ( $file ) == getmyuid ()) { return true ; } return false ; } func ... er , $fp ) = new_xml_parser ( $systemId )) { printf ( "Could not open entity %s at %s\n" , $openEntityNames , $systemId ); return false ; } while ( $data = fread ( $fp , 4096 )) { if (! xml_parse ( $parser , $data , feof ( $fp ))) { printf ( "XML error ... y %s\n" , xml_error_string ( xml_get_error_code ( $parser )), xml_get_current_line_number ( $parser ), $openEntityNames ); return false ; } } return true ; } return false ; } function new_xml_parser ( $file ) { global $parser_file ; $xml_parser = xml_p ...
https://man.mtool.work/php/8.3/example.xml-external-entity.html
Apache Solr | PHP 8.3 8875
Apache Solr はじめに Solr 拡張モジュールにより、PHP で Apache Solr サーバーと効果的に通信できます。 Solr 拡張モジュールは、PHP 開発者が Solr サーバーのインスタンスと効果的に通信できるようにする、とても速くて軽量で、豊富な機能を持つライブラリ ... が存在するかチェック SolrInputDocument::getBoost — 文書に対する現行の boost 値を取得 SolrInputDocument::getChildDocuments — Returns an array of child documents (SolrInputDocument) SolrInputDocument::getChildDocumentsCount — Returns the number of child d ... ド数を返す SolrInputDocument::getFieldNames — 文書内のフィールドを全て含む配列を返す SolrInputDocument::hasChildDocuments — Returns true if the document has any child documents SolrInputDocument::merge — Merges one input document into another SolrInputD ... nt::deleteById — Delete by Id SolrClient::deleteByIds — Deletes by Ids SolrClient::deleteByQueries — Removes all documents matching any of the queries SolrClient::deleteByQuery — Deletes all documents matching the given query SolrClient::__destruct — ...
https://man.mtool.work/php/8.3/book.solr.html
The SolrQuery class | PHP 8.3 8861
The SolrQuery class (PECL solr >= 0.9.2) はじめに Represents a collection of name-value pairs sent to the Solr server during a request. クラス概要 class SolrQuery extends SolrModifiableParams implements Serializable { /* 定数 */ const int O ... etHighlightRegexPattern (): string public function getHighlightRegexSlop (): float public function getHighlightRequireFieldMatch (): bool public function getHighlightSimplePost ( string $field_override = ? ): string public function getHighlightSimpleP ... axCount (): int public function getTermsMinCount (): int public function getTermsPrefix (): string public function getTermsReturnRaw (): bool public function getTermsSort (): int public function getTermsUpperBound (): string public function getTimeAllo ... ue ): SolrQuery public function setHighlightRegexSlop ( float $factor ): SolrQuery public function setHighlightRequireFieldMatch ( bool $flag ): SolrQuery public function setHighlightSimplePost ( string $simplePost , string $field_override = ? ): Solr ...
https://man.mtool.work/php/8.3/class.solrquery.html
str_contains — 指定された部分文字列が、文字列に含まれるかを調べる | PHP 8.3 8848
str_contains (PHP 8) str_contains — 指定された部分文字列が、文字列に含まれるかを調べる 説明 function str_contains ( string $haystack , string $needle ): bool needle が haystack に含まれるかを調べます。 大文字小文字は区別されます。 パラメータ ... 字列 '' を使った場合 <?php if ( str_contains ( 'abc' , '' )) { echo "Checking the existence of the empty string will always return true" ; } ?> 上の例の出力は以下となります。 Checking the existence of the empty string will always return true 例2 大文字小 ... azy' )) { echo 'The string "Lazy" was found in the string' ; } else { echo '"Lazy" was not found because the case does not match' ; } ?> 上の例の出力は以下となります。 The string 'lazy' was found in the string "Lazy" was not found because the case doe ... s not match 注意 注意 : この関数はバイナリデータに対応しています。 参考 str_ends_with() - 文字列が、指定された文字列で終わるかを調べる ...
https://man.mtool.work/php/8.3/function.str-contains.html
PREV 1 2 3 4 5 6 NEXT