Page 1 of 1

Replacing spaces in an array

Posted: Wed Dec 10, 2003 4:24 pm
by goblinhybrid
how do i replace a space in an array with nothing??
thanks

Posted: Wed Dec 10, 2003 4:32 pm
by Gen-ik

Code: Select all

<?php

$array[] = "Text With Space One";
$array[] = "Text With Space Two";

foreach($array as $key => $value)
$array[$key] = str_replace(" ", "", $value);

?>