Title: Fatal error: Cannot redeclare get_string_between()
Last modified: August 20, 2016

---

# Fatal error: Cannot redeclare get_string_between()

 *  [gearu](https://wordpress.org/support/users/gearu/)
 * (@gearu)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-get_string_between/)
 * I have a custom view for nextGenGallery, in which i call the function “get_string_between”.
 * If I perform a search that returns a page with this gallery view used, I get 
   an error from Search Unleashed – presumibly becuase it is also trying to use 
   the ‘get_string_between()’ function.
 * **Fatal error: Cannot redeclare get_string_between() (previously declared in …**
 * is there a way that I can wrap the call i make to this function somehow so that
   it does not get called if it is already in use?
 * this is how it is called in my php:
 *     ```
       <?php
       		//Used to break down and extract the width and height of each image
       		function get_string_between($string, $start, $end){
       			$string = " ".$string;
       			$ini = strpos($string,$start);
       			if ($ini == 0) return "";
       			$ini += strlen($start);
       			$len = strpos($string,$end,$ini) - $ini;
       			return substr($string,$ini,$len);
       		}
       	?>
       ```
   

Viewing 1 replies (of 1 total)

 *  Thread Starter [gearu](https://wordpress.org/support/users/gearu/)
 * (@gearu)
 * [14 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-get_string_between/#post-2274375)
 * I eventually fixed this error by moving this function into my functions.php so
   that it didn’t get defined a second time. this solved the problem.

Viewing 1 replies (of 1 total)

The topic ‘Fatal error: Cannot redeclare get_string_between()’ is closed to new 
replies.

 * ![](https://s.w.org/plugins/geopattern-icon/search-unleashed.svg)
 * [Search Unleashed](https://wordpress.org/plugins/search-unleashed/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/search-unleashed/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/search-unleashed/)
 * [Active Topics](https://wordpress.org/support/plugin/search-unleashed/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/search-unleashed/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/search-unleashed/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [gearu](https://wordpress.org/support/users/gearu/)
 * Last activity: [14 years, 4 months ago](https://wordpress.org/support/topic/fatal-error-cannot-redeclare-get_string_between/#post-2274375)
 * Status: not resolved