3v4l.org

run code in 300+ PHP versions simultaneously
<?php class toStr { private $str; public function __construct( $str ) { $this->str = $str; } public function __toString() { return $this->str; } } $a = new toStr( 'hi' ); var_dump( $a === 'hi' ); var_dump( $a == 'hi' );

preferences:
51.43 ms | 402 KiB | 5 Q