Create an array from a string // Crear un array utilizando un string

/* * Create an array from a string * * @ string $value * @ return array */ function createArrayFromString($value){ // /[\s]+/ means space $arrayValue = preg_split("/[\s]+/", $value); $count = count ($arrayValue); $x = 0; while($count > $x){ // Delete array value if it is null or with space if(empty($arrayValue[$x]) || $arrayValue[$x] == " "){ unset($arrayValue[$x]); } $x=$x+1; } return $arrayValue; }

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.