Mirexzpalich
а если это не заранее подготовленное слово,а переменная $name ?как тогда быть?
<html>
<head>
<title>
Не понятно....
</title>
<script>
function nick()
{
var text = document.getElementById('text_nick').value.replace(/^(.)(.*)$/,"<span style='color:red'><b>$1</b></span>$2");
document.getElementById('nick').innerHTML = text;
}
</script>
<body>
Введите ник: <input type="text" id="text_nick" onkeydown="nick();" /><br />
<span id="nick"></span>
</body>
</html>
<?php
if(!empty($_GET['slovo']))
{
$_GET['slovo'] = //тот скрипт
echo htmlspecialchars($_GET['slovo']).'<br/><br/>';
}
?>
<form action="" method="get">
<input type="text" name="slovo" />
<input type="submit" value="Отправить" />
</form>
<?php
$str = "privet"; // Слово
$slovo = substr($str,0,1); // выбирается первая буква из слова
$color = "<font color = red>" . $slovo . "</font>"; // делается красной
$str = $color . substr($str,1); // склеивается наша красная буква и оставшееся слово
echo $str; // Выводим
?>
один
два
три
четыре
<?php
$str = 'один<br/>два<br/>три<br/>четыре';
function StringOperation($str, $rand = false)
{
$array = explode('<br>', $str);
if(count($array) == 1)
{
$array = explode('<br/>', $str);
if(count($array) == 1)
{
$array = explode('<br />', $str);
}
}
if($rand)
{
shuffle($array);
foreach($array as $value)
{
$return .= $value.'<br />';
}
}
else
{
$array = array_reverse($array);
foreach($array as $value)
{
$return .= $value.'<br />';
}
}
return $return;
}
echo StringOperation($str, true);
?>