ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
common.php File Reference

Go to the source code of this file.

Functions

 assertCli ()
 
 prefix_is ($comp, $subject)
 
 postfix_is ($comp, $subject)
 

Function Documentation

◆ assertCli()

assertCli ( )

Definition at line 3 of file common.php.

References exit.

4 {
5  if (php_sapi_name() != 'cli' && !getenv('PHP_IS_CLI')) {
6  echo 'Script cannot be called from web-browser (if you are indeed calling via cli,
7 set environment variable PHP_IS_CLI to work around this).';
8  exit(1);
9  }
10 }

◆ postfix_is()

postfix_is (   $comp,
  $subject 
)

Definition at line 17 of file common.php.

18 {
19  return strlen($subject) < $comp ? false : substr($subject, -strlen($comp)) === $comp;
20 }

◆ prefix_is()

prefix_is (   $comp,
  $subject 
)

Definition at line 12 of file common.php.

13 {
14  return strncmp($comp, $subject, strlen($comp)) === 0;
15 }