Welcome Guest, Not a member yet? Register   Sign In
how to split a string
#8

[eluser]megabyte[/eluser]
Code:
$length = strlen($str);
$offset = $length/2;
$pos = strpos($str, ' ', $offset);
$first = substr($str, 0, $pos);
$last = substr($str, $pos);
echo $first;
echo "<br />";
echo $last;


Well you helped me solve it in 3 minutes vs the 3 hours i spent not solving it. thanks.


Messages In This Thread
how to split a string - by El Forum - 10-12-2009, 06:27 PM
how to split a string - by El Forum - 10-12-2009, 06:36 PM
how to split a string - by El Forum - 10-12-2009, 06:45 PM
how to split a string - by El Forum - 10-12-2009, 06:48 PM
how to split a string - by El Forum - 10-12-2009, 06:55 PM
how to split a string - by El Forum - 10-12-2009, 07:01 PM
how to split a string - by El Forum - 10-12-2009, 07:07 PM
how to split a string - by El Forum - 10-12-2009, 07:24 PM
how to split a string - by El Forum - 10-12-2009, 07:53 PM
how to split a string - by El Forum - 10-13-2009, 05:32 AM
how to split a string - by El Forum - 10-13-2009, 09:29 AM
how to split a string - by El Forum - 10-13-2009, 05:22 PM



Theme © iAndrew 2016 - Forum software by © MyBB