PHP 8.4.6 Released!

Voting

: five plus two?
(Example: nine)

The Note You're Voting On

php at lanar dot com dot au
11 years ago
Objects implementing ArrayAccess do not support the increment/decrement operators ++ and --, unlike array() and ArrayObject()

<?php

class MyArray implements ArrayAccess
{
// offsetSet, offsetGet etc implemented
}

$x = new MyArray() ;
$x[0] = 0 ;
$x[0]++ ; //error 'Indirect modification of overloaded element has no effect'
$x[0] += 1 ; // this works OK.

?>

<< Back to user notes page

AltStyle によって変換されたページ (->オリジナル) /