monsterinsights_string_ends_with

The Google Analytics for WordPress by MonsterInsights monsterinsights string ends with function.

Description

monsterinsights_string_ends_with( $string, $ending ); 

Parameters (2)

0. $string
The string.
1. $ending
The ending.

Usage

  1. if ( !function_exists( 'monsterinsights_string_ends_with' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/helpers.php'; 
  3.  
  4. // The string. 
  5. $string = null; 
  6.  
  7. // The ending. 
  8. $ending = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = monsterinsights_string_ends_with($string, $ending); 
  12.  

Defined (1)

The function is defined in the following location(s).

/includes/helpers.php  
  1. function monsterinsights_string_ends_with( $string, $ending ) { 
  2. $strlen = strlen($string); 
  3. $endinglen = strlen($ending); 
  4. if ( $endinglen > $strlen ) { 
  5. return false; 
  6. return substr_compare( $string, $ending, $strlen - $endinglen, $endinglen) === 0;