Title: function sb_return_kbytes error on PHP 7
Last modified: May 27, 2019

---

# function sb_return_kbytes error on PHP 7

 *  Resolved [Art Smith](https://wordpress.org/support/users/ambrosiawt/)
 * (@ambrosiawt)
 * [7 years ago](https://wordpress.org/support/topic/function-sb_return_kbytes-error-on-php-7/)
 * In the function sb_return_kbytes, PHP now issues a notice (which my site kindly
   displays on the public side of the site) indicating that at line 267 (when the
   case is “m”) the computation is working with non-numeric data. Indeed, the “M”
   or “G” are still embedded in the $val variable. The following code corrects the
   issue:
 *     ```
       function sb_return_kbytes($val) {
               $val = trim($val);
               $last = strtolower($val[strlen($val)-1]);
               $val = preg_replace("/[^0-9.]/", "", $val);  // <- add this line
               switch($last) {
                       case 'g':
                               $val *= 1024;
                       case 'm':
                               $val *= 1024;
               }
          return intval($val);
       }
       ```
   
 * Art Smith

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Thread Starter [Art Smith](https://wordpress.org/support/users/ambrosiawt/)
 * (@ambrosiawt)
 * [6 years, 12 months ago](https://wordpress.org/support/topic/function-sb_return_kbytes-error-on-php-7/#post-11581859)
 * You can ignore this. Even though it’s generating a notification, I guess it’s
   okay. I’ve managed to solve the problem of notifications getting into the admin
   pages html. 🙂
 *  [general.chaos](https://wordpress.org/support/users/generalchaos-1/)
 * (@generalchaos-1)
 * [6 years, 8 months ago](https://wordpress.org/support/topic/function-sb_return_kbytes-error-on-php-7/#post-11894165)
 * So you were able to get sermon browser working properly using PHP 7? Do you mind
   sharing your work?
 * This issue still has some of us stuck: [https://wordpress.org/support/topic/php-7-compatibility-235/](https://wordpress.org/support/topic/php-7-compatibility-235/)

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘function sb_return_kbytes error on PHP 7’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/sermon-browser_10232e.svg)
 * [Sermon Browser](https://wordpress.org/plugins/sermon-browser/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/sermon-browser/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/sermon-browser/)
 * [Active Topics](https://wordpress.org/support/plugin/sermon-browser/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/sermon-browser/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/sermon-browser/reviews/)

## Tags

 * [non-numeric](https://wordpress.org/support/topic-tag/non-numeric/)
 * [php-7](https://wordpress.org/support/topic-tag/php-7/)

 * 2 replies
 * 2 participants
 * Last reply from: [general.chaos](https://wordpress.org/support/users/generalchaos-1/)
 * Last activity: [6 years, 8 months ago](https://wordpress.org/support/topic/function-sb_return_kbytes-error-on-php-7/#post-11894165)
 * Status: resolved