Skip to content

Instantly share code, notes, and snippets.

@beberlei
Created September 16, 2024 11:57
Show Gist options
  • Select an option

  • Save beberlei/7f91cdb40233f75eea4031b92829e5d6 to your computer and use it in GitHub Desktop.

Select an option

Save beberlei/7f91cdb40233f75eea4031b92829e5d6 to your computer and use it in GitHub Desktop.
<?php
class Foo {
public string $foo = 'foo';
public function setString($value): void {
$this->foo = $value;
}
public function getString(): string {
return $this->foo;
}
}
$foo = new Foo();
$bar = null;
$iter = 10_000_000;
while(--$iter) {
$foo->setString("foo" . $iter);
$bar = $foo->getString();
}
<?php
class Foo {
private string $_foo;
public string $foo {
get => $this->_foo;
set { $this->_foo = $value; }
}
}
$foo = new Foo();
$bar = null;
$iter = 10_000_000;
while(--$iter) {
$foo->foo = "foo" . $iter;
$bar = $foo->foo;
}
<?php
class Foo {
public string $foo = 'foo';
}
$foo = new Foo();
$bar = null;
$iter = 10_000_000;
while(--$iter) {
$foo->foo = "foo" . $iter;
$bar = $foo->foo;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment