You are here

function _explode_to_int in Shadowbox 6.2

Same name and namespace in other branches
  1. 5.2 shadowbox.module \_explode_to_int()
  2. 5 shadowbox.module \_explode_to_int()
  3. 6.4 shadowbox.module \_explode_to_int()
  4. 6 shadowbox.module \_explode_to_int()
  5. 6.3 shadowbox.module \_explode_to_int()
  6. 7.4 shadowbox.admin.inc \_explode_to_int()
  7. 7.3 shadowbox.admin.inc \_explode_to_int()

Convert numerical value(s) within a delimited string to integer(s).

Explode a space delimited string e.g. 'a b 2' and cast numeric string values to integers.

Parameters

$string: A space delimited string.

Return value

An array containing strings and integers.

File

./shadowbox.module, line 1015
Shadowbox, a JavaScript media viewer application for displaying content in a modal dialogue.

Code

function _explode_to_int($string) {
  foreach (explode(' ', $string) as $value) {
    $output[] = is_numeric($value) ? (int) $value : $value;
  }
  return $output;
}