function fp_trim

7.x misc.inc fp_trim($val = NULL)
6.x misc.inc fp_trim($str)

This is a simple function which attempts to trim a String. However, if $val is NOT a string, it will cast it to string.

This is to prevent deprecated warnings in PHP 8+, and can be used as a drop-in replacement in place of trim()

35 calls to fp_trim()
admin_display_courses in modules/admin/admin.courses.inc
This function displays all of our courses for us to edit.
admin_edit_course_form_submit in modules/admin/admin.courses.inc
admin_edit_degree_form in modules/admin/admin.degrees.inc
Meant to replace the old-fashioned display_edit_degree function...
admin_edit_degree_form_submit in modules/admin/admin.degrees.inc
admin_edit_degree_form_validate in modules/admin/admin.degrees.inc

... See full list

File

includes/misc.inc, line 2489
This file contains misc functions for FlightPath

Code

function fp_trim($val = NULL) {

  if (is_string($val)) {
    return trim($val);
  }

  if (is_numeric($val)) {
    $val = "" . $val;
    return trim($val);
  }

  if ($val === NULL || $val === FALSE) {
    return '';
  }


  // if $val is an array or object, intentionally return the trim() so it will cause a warning.
  return trim($val);

}