Skip to content
Justice Tech School

Checking Strings

str_contains, str_starts_with and str_ends_with give clear answers. Use === false with strpos.

Example
var_dump(str_contains("hello", "ell"), str_starts_with("hello", "he"), str_ends_with("hello", "x"));

Result

bool(true)
bool(true)
bool(false)

Exercise

Starts with.

str_with("hello", "he")

Quiz Test

Which tests a prefix?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.