str::contains($str, $needle, $i = true)

Checks if a str contains another string

  • $str (string)
  • $needle (string)
  • $i (boolean)
    ignore upper/lowercase
  • return (string)

Example

<?php
$string = 'Kirby is a file-based CMS';
if(str::contains($string, 'kirby')) {
  echo 'The string contains the needle.';
} else {
  echo 'The needle cannot be found in the haystack.';
}