function fp_get_machine_readable

7.x misc.inc fp_get_machine_readable($str)
6.x misc.inc fp_get_machine_readable($str)
5.x misc.inc fp_get_machine_readable($str)

Simple function to convert a string into a machine-readable string.

Useful for making possibly unsafe text work as an array index, a CSS class, etc. Replaces "bad" characters, or characters which might not be allowed for variables, for example, into underscores (_).

Parameters

string $str:

Return value

string

54 calls to fp_get_machine_readable()
admin.groups.inc in modules/admin/admin.groups.inc
admin_edit_group_form_validate in modules/admin/admin.groups.inc
Validate handler for edit group form.
advise.module in modules/advise/advise.module
advise_display_popup_change_term in modules/advise/advise.module
This popup allows the advisor to change the advising term.
advise_what_if_selection_form in modules/advise/advise.module

... See full list

File

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

Code

function fp_get_machine_readable($str) {
  return preg_replace('@[^a-zA-Z0-9_]+@', '_', $str);
}