Hi ! I'm using the PHP Explode() function to seperate some strings. For example, if I explode the following string: and use the 's' as the separator, I get the following output in a webpage: I was wondering how I could instead format the results so that they display like this in a webpage: I've tried placing the <br /> tag in my code, but have either missed where it should go, or this is not the right way in the first place. This is the function call: Thanks will go to anyone who can help me with this! Thanks!
Place the print_r inside <pre></pre> tags. echo '<pre>'; print_r($array); echo '</pre>'; Code (markup):
You have to learn a lot if you are unable to solve this. Read the first part of the manual at www.php.net and practice a lot: <?php if(isset($_POST['submit'])) { $data = explode($_POST['seperator'],$_POST['string']); foreach($data as $k => $v) { echo "[$k] => $v <br />"; } ?> PHP: