Shoutbox

PHP help - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: PHP help (/showthread.php?tid=49788)

PHP help by spokes on 08-31-2005 at 03:18 PM

Can anybody help me?

Im making an msn nickname thing in php, and i need it to go through each letter the user types

and for example put a < in front of that letter and > at the end

say i type
Spokes

i need it so it says

<S><p><o><k><e><s>


RE: PHP help by WDZ on 08-31-2005 at 03:30 PM

Something like this?

code:
<?php

$input = 'Spokes';

$output = '';
for($i = 0; $i < strlen($input); $i++) {
    $output .= '<'.substr($input, $i, 1).'>';
}

echo $output;

?>

RE: PHP help by RaceProUK on 08-31-2005 at 03:43 PM

Why you asked for help for something so simple, I don't know.

Note: be careful about where you use the resulting text. You may need to convert the '<' and '>' to '&lt;' and '&gt;' (there's a function that does that in PHP btw).