Content deleted Content added
No edit summary |
Add portal |
||
Line 115:
In [[PHP]] indexing can be implemented via the predefined {{code|ArrayAccess}} interface,<ref>{{cite web|url=https://www.php.net/manual/en/class.arrayaccess.php|title=PHP ArrayAccess interface}}</ref>
<syntaxhighlight lang="php">
class Vector implements ArrayAccess
{
Line 140 ⟶ 139:
for ($i = 0; $i < $vector->size; $i++) $vector[$i] = $i + 1;
for ($i = 0; $i < $vector->size; $i++) print "{$vector[$i]}\n";
</syntaxhighlight>
Line 220 ⟶ 218:
== See also ==
{{Portal|Computer programming}}
* [[Mutator method]]
|