function fp_get_machine_readable

6.x misc.inc fp_get_machine_readable($str)
4.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

unknown_type $str:

Return value

unknown

2 calls to fp_get_machine_readable()
update_status_status in modules/update_status/update_status.module
Implementation of hook_status.
user_display_users in modules/user/user.module
Display our list of faculty/staff users in the system.

File

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

Code

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