scanFull() публичный Метод

Advances the scan pointer if +advance_pointer_p+ is true. Returns the matched string if +return_string_p+ is true. The match register is affected. "full" means "#scan with full parameters".
public scanFull ( string $pattern, boolean $advance_pointer, boolean $return_string ) : mixed
$pattern string The regular expression
$advance_pointer boolean Wheter to update the pointer or not
$return_string boolean Wheter to return the matched string or the position
Результат mixed Either the matched string (if $return_string is true) or the end position of the match
Пример #1
0
 function testScanFull()
 {
     $sc = new StringScanner("foobar blorg bla");
     $res = $sc->scanFull("foo", false, false);
     $this->assertEqual($res, true);
     $this->assertEqual($sc->rest(), "foobar blorg bla");
     $this->assertEqual($sc->getMatched(), "foo");
     $res = $sc->scanFull("bla", false, false);
     $this->assertEqual($res, null);
     $this->assertEqual($sc->rest(), "foobar blorg bla");
     $res = $sc->scanFull("foobar", true, false);
     $this->assertEqual($res, "foobar");
     $this->assertEqual($sc->rest(), "foobar blorg bla");
     $this->assertEqual($sc->getMatched(), "foobar");
     $res = $sc->scanFull("\\w+", true, true);
     $this->assertEqual($res, "foobar");
     $this->assertEqual($sc->rest(), " blorg bla");
     $this->assertEqual($sc->getMatched(), "foobar");
 }