str::isURL($string)

Checks if the given string is a URL

  • $string (string)
    A string
  • return (boolean)

Example

<?php
$string = 'https://getkirby.com';
if(str::isURL($string)) {
  echo str::link($string, 'Visit our website');
} else {
  echo 'The given string is not a valid URL';
}