View difference between Paste ID: FsndxpLr and nHAfF9bi
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
class Test
4
{
5
  public $something = 'hello';
6
7
  public function __toString()
8
  {
9
    return $this->something;
10
  }
11
}
12
13-
$t = new Test();
13+
$t = new Test;
14
var_dump(strlen($t));
15-
var_dump($t->something);
15+
var_dump($t->something);
16
17
class Test2
18
{
19
  public $something;
20
21
  public function __construct(&$a)
22
  {
23
    $this->something = &$a;
24
  }
25
26
  public function __toString()
27
  {
28
    return $this->something;
29
  }
30
}
31
32
$a = 'hello2';
33
$t2 = new Test2($a);
34
var_dump(strlen($t2));
35
var_dump($t2->something);
36
var_dump($a);
37
$a = 'hello23';
38
var_dump(strlen($t2));
39
var_dump($t2->something);