3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Reference { function __construct($value) { $this->value = $value; } function startsWith($something, $start = 0) { return strpos($this->value, $something) === $start; } } $subject = new Reference("AWB012345"); $result = $subject->startsWith("AWB0"); var_dump($result); $subject = new Reference("12345"); $result = $subject->startsWith("AWB0"); var_dump($result);
based on aZsfV
Output for 5.0.0 - 7.2.0
bool(true) bool(false)
Output for 4.3.0 - 4.4.9
Notice: Undefined property: value in /in/JGh91 on line 9 bool(false) Notice: Undefined property: value in /in/JGh91 on line 9 bool(false)