nsSubStrEl

The NextScripts: Social Networks Auto-Poster nsSubStrEl function.

Description

nsSubStrEl( $string, $length, (string) $end = '...' ); 

Parameters (3)

0. $string
The string.
1. $length
The length.
2. $end — Optional. (string) => '...'
The end.

Usage

  1. if ( !function_exists( 'nsSubStrEl' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4. // The string. 
  5. $string = null; 
  6.  
  7. // The length. 
  8. $length = null; 
  9.  
  10. // The end. 
  11. $end = '...'; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = nsSubStrEl($string, $length, $end); 
  15.  

Defined (1)

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

/nxs_functions.php  
  1. if (!function_exists('nsSubStrEl')) { function nsSubStrEl($string, $length, $end='...') { if (strlen($string) > $length) { $length -= strlen($end); $string = substr($string, 0, $length); $string .= $end; } return $string;}}