<?php declare(strict_types=1); $s = "user@example.com"; // strpos returns the index of the first match echo strpos($s, "@"), "\n"; // test with === false, since 0 is a valid index var_dump(strpos($s, "z") === false);
strpos returns an index or false