← All docs
strstr()
Returns the portion of a string starting at the first occurrence of a substring, or false.
strstr()
function strstr(string $haystack, string $needle, bool $before_needle = false): mixed
Returns the portion of a string starting at the first occurrence of a substring, or false.
Parameters:
$haystack(string)$needle(string)$before_needle(bool), defaultfalse, optional
Returns: mixed
Availability
- Compiled (AOT): supported by the Elephc code generator.
eval()(magician interpreter): supported — declarative interpreter builtin (crates/elephc-magician/src/interpreter/builtins/string/strstr.rs).
No examples yet — check examples/ and showcases/ for usage patterns.
Internals
For how strstr is implemented in the compiler, see the internals page.