« PHP 8.3 Manual トップ
著作権 »
per page, with , order by , clip by
Results of 1 - 10 of about 32 for counter (0.002 sec.)
APCUIterator::__construct — APCUIterator イテレータオブジェクトを作成する | PHP... 12050
APCUIterator::__construct (PECL apcu >= 5.0.0) APCUIterator::__construct — APCUIterator イテレータオブジェクトを作成する 説明 public function APCUIterator::__construct ( array | string | null $search = null , int $format = APC_ITER_ALL , in ... ACTIVE あるいは APC_LIST_DELETED を渡します。 例 例1 APCUIterator::__construct() の例 <?php foreach (new APCUIterator ( '/^counter\./' ) as $counter ) { echo " $counter [ key ] : $counter [ value ] \n" ; apc_dec ( $counter [ 'key' ], $counter [ 'value' ...
https://man.mtool.work/php/8.3/apcuiterator.construct.html
変数のスコープ | PHP 8.3 11663
変数のスコープ 変数のスコープは、その変数が定義されたコンテキストです。 PHP には関数スコープとグローバルスコープがあります。 関数の外部で定義されたあらゆる変数は、グローバルスコープになります。 ファイルが include された場合、 そのファイルに ... の内部にある static 変数 <?php function exampleFunction ( $input ) { $result = (static function () use ( $input ) { static $counter = 0 ; $counter ++; return "Input: $input , Counter: $counter \n" ; }); return $result (); } // Calls to exampleFunction wi ... onymous function, so the static // variable does not retain its value. echo exampleFunction ( 'A' ); // Outputs: Input: A, Counter: 1 echo exampleFunction ( 'B' ); // Outputs: Input: B, Counter: 1 (オーバーライドされていない場合) 内部でstatic 変数を使っ ... 初期化できるようになったということです。 例11 継承されたメソッドのstatic 変数を使う <?php class Foo { public static function counter () { static $counter = 0 ; $counter ++; return $counter ; } } class Bar extends Foo {} var_dump ( Foo :: counter ()); // i ...
https://man.mtool.work/php/8.3/language.variables.scope.html
Memcached::decrement — 数値アイテムの値を減らす | PHP 8.3 11373
Memcached::decrement (PECL memcached >= 0.1.0) Memcached::decrement — 数値アイテムの値を減らす 説明 public function Memcached::decrement ( string $key , int $offset = 1 , int $initial_value = 0 , int $expiry = 0 ): int | false Memcached::de ... ます。 例 例1 Memcached::decrement() の例 <?php $m = new Memcached (); $m -> addServer ( 'localhost' , 11211 ); $m -> set ( 'counter' , 5 ); $n = $m -> decrement ( 'counter' ); var_dump ( $n ); $n = $m -> decrement ( 'counter' , 10 ); var_dump ( $n ); var ... _dump ( $m -> get ( 'counter' )); $m -> set ( 'counter' , 'abc' ); $n = $m -> increment ( 'counter' ); // アイテムの値が数値でないので、これは失敗します ...
https://man.mtool.work/php/8.3/memcached.decrement.html
Memcached::increment — 数値アイテムの値を増やす | PHP 8.3 10680
Memcached::increment (PECL memcached >= 0.1.0) Memcached::increment — 数値アイテムの値を増やす 説明 public function Memcached::increment ( string $key , int $offset = 1 , int $initial_value = 0 , int $expiry = 0 ): int | false Memcached::in ... ます。 例 例1 Memcached::increment() の例 <?php $m = new Memcached (); $m -> addServer ( 'localhost' , 11211 ); $m -> set ( 'counter' , 0 ); $m -> increment ( 'counter' ); $n = $m -> increment ( 'counter' , 10 ); var_dump ( $n ); $m -> set ( 'counter' , ' ... abc' ); $n = $m -> increment ( 'counter' ); // アイテムの値が数値でないので、これは失敗します var_dump ( $n ); ?> 上の例の出力は以下となります。 int(11) bool(fals ...
https://man.mtool.work/php/8.3/memcached.increment.html
Countable::count — オブジェクトの要素の数を数える | PHP 8.3 10294
Countable::count (PHP 5 >= 5.1.0, PHP 7, PHP 8) Countable::count — オブジェクトの要素の数を数える 説明 public function Countable::count (): int このメソッドは、 count() 関数の value パラメータが Countable を実装している場合に実行されます。 ... にはパラメータはありません。 戻り値 数えたカスタムの結果を整数値として返します。 例 例1 Countable::count() の例 <?php class Counter implements Countable { private $count = 0 ; public function count (): int { return ++ $this -> count ; } } $counter = new ... Counter ; for ( $i = 0 ; $i < 10 ; ++ $i ) { echo "I have been count()ed " . count ( $counter ) . " times\n" ; } ?> 上の例の出力は、 たとえば以下のようになります。 I have been count()ed 1 times I have been count()ed ...
https://man.mtool.work/php/8.3/countable.count.html
SyncMutex::unlock — Unlocks the mutex | PHP 8.3 9794
SyncMutex::unlock (PECL sync >= 1.0.0) SyncMutex::unlock — Unlocks the mutex 説明 public function SyncMutex::unlock ( bool $all = false ): bool Decreases the internal counter of a SyncMutex object. When the internal counter reaches zero, th ... e actual lock on the object is released. パラメータ all Specifies whether or not to set the internal counter to zero and therefore release the lock. 戻り値 成功した場合に true を、失敗した場合に false を返します。 例 例1 SyncMutex: ...
https://man.mtool.work/php/8.3/syncmutex.unlock.html
下位互換性のない変更点 | PHP 8.3 9118
下位互換性のない変更点 PHP コア $GLOBALS へのアクセス制限 $GLOBALS 配列へのアクセスに対し、 多くの制限が適用されるようになりました。 $GLOBALS['var'] のような、 個別の配列要素に対する読み取りや書き込みは、 これまで通り動作します。 $GLOBALS 配 ... 合、継承されたメソッドは static 変数を親クラスのメソッドと共有するようになりました。 <?php class A { public static function counter () { static $counter = 0 ; $counter ++; return $counter ; } } class B extends A {} var_dump ( A :: counter ()); // int(1) ... var_dump ( A :: counter ()); // int(2) var_dump ( B :: counter ()); // int(3), 以前のバージョンでは int(1) var_dump ( B :: counter ()); // int(4), ... ョンでは、 以下のコードは推奨されない警告を発生させていましたが、 呼び出しは成功していました。 PHP 8.1.0 以降では、 ArgumentCountError がスローされるようになっています。 位置を指定して呼び出した場合でも、同じエラーがスローされます。 <?php function makeyo ...
https://man.mtool.work/php/8.3/migration81.incompatible.html
wincache_ucache_cas — 変数を古い値と比較して新しい値を代入する | PHP 8.3 8812
wincache_ucache_cas (PECL wincache >= 1.1.0) wincache_ucache_cas — 変数を古い値と比較して新しい値を代入する 説明 function wincache_ucache_cas ( string $key , int $old_value , int $new_value ): bool 指定したキーの変数を old_value と比較し、 ... 成功した場合に true を、失敗した場合に false を返します。 例 例1 wincache_ucache_cas() の使用法 <?php wincache_ucache_set ( 'counter' , 2922 ); var_dump ( wincache_ucache_cas ( 'counter' , 2922 , 1 )); var_dump ( wincache_ucache_get ( 'counter' )); ?> 上の ...
https://man.mtool.work/php/8.3/function.wincache-ucache-cas.html
トレイト | PHP 8.3 8522
トレイト PHP は、コードを再利用するための「トレイト」という仕組みを実装しています。 トレイトは、PHP のような単一継承言語でコードを再利用するための仕組みのひとつです。 トレイトは、単一継承の制約を減らすために作られたもので、 いくつかのメソッ ... 、 推奨されなくなりました。 これらは、トレイトを使っているクラスからのみアクセスすべきものです。 例9 static変数 <?php trait Counter { public function inc () { static $c = 0 ; $c = $c + 1 ; echo " $c \n" ; } } class C1 { use Counter ; } class C2 { use Cou ... している場合、 親クラスで定義された static プロパティとは別物とみなされるようになりました。 <?php trait T { public static $counter = 1 ; } class A { use T ; public static function incrementCounter () { static:: $counter ++; } } class B extends A { use T ... ; } A :: incrementCounter (); echo A :: $counter , "\n" ; echo B :: $counter , "\n" ; ?> 上の例の PHP 8.3 での出力は、このようになります。: 2 1 プロ ...
https://man.mtool.work/php/8.3/language.oop5.traits.html
sodium_crypto_stream_xchacha20_xor_ic — nonce と秘密鍵を使ってメッセージを暗号... 8328
sodium_crypto_stream_xchacha20_xor_ic (PHP 8 >= 8.2.0) sodium_crypto_stream_xchacha20_xor_ic — nonce と秘密鍵を使ってメッセージを暗号化する(認証なし) 説明 function sodium_crypto_stream_xchacha20_xor_ic ( #[ \SensitiveParameter ] string $mes ... sage , string $nonce , int $counter , #[ \SensitiveParameter ] string $key ): string この関数は、 sodium_crypto_stream_xchacha20_xor() に似ていますが、ブロック ... pt() や sodium_crypto_auth() を使うことが考えられます。 パラメータ message 暗号化するメッセージ。 nonce 24バイトの nonce。 counter ブロックカウンタの初期値。 key 暗号化キー。 sodium_crypto_stream_xchacha20_keygen() で生成されたものです。 戻り値 暗号化さ ... at once: $stream7_unified = sodium_crypto_stream_xchacha20_xor ( $left . $right , $n2 , $key ); // Piecewise, with initial counter: $stream7_left = sodium_crypto_stream_xchacha20_xor_ic ( $left , $n2 , 0 , $key ); $stream7_right = sodium_crypto_stream_x ...
https://man.mtool.work/php/8.3/function.sodium-crypto-stream-xchacha20-xor-ic.ht...
PREV 1 2 3 4 NEXT