function fp_trim
Search API
| 7.x misc.inc | fp_trim( |
| 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()
91 calls to fp_trim()
- admin.courses.inc in modules/
admin/ admin.courses.inc - admin.degrees.inc in modules/
admin/ admin.degrees.inc - admin.groups.inc in modules/
admin/ admin.groups.inc - admin.module in modules/
admin/ admin.module - The administrative configurations for FlightPath.
- admin_display_courses in modules/
admin/ admin.courses.inc - This function displays all of our courses for us to edit.
File
- includes/
misc.inc, line 2707 - 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);
}
