The function is unusable in that way, its so much logical to write an array... It can be used for some ad links for example, or one line of text, but for storing a post in db nope.
Generate Rainbow Text
Collapse
X
-
the above code snippet was just an example of how you could use without an array.
i didnt realise i would have to go as far as writing this next function to add a bbcode parser etc.
thought you guys may see the potential in the snippet and add as necessary.
PHP Code:<?php
function rainbow($data) {
$data = preg_replace_callback('/\[rainbow\](.*?)\[\/rainbow\]/msi', create_function('$matches', '{
$rainbow = \'\';
for($i=0; $i<strlen($matches[1]); ++$i){
$letter = str_split($matches[1]);
if($letter[$i] != \' \'){
$rainbow .= \'<span style="color:#\'.substr(str_shuffle(\'ABCDEF0123456789\'), 0, 6).\';">\'.$letter[$i].\'</span>\';
} else {
$rainbow .= \' \';
}
}
return $rainbow;
}') , $data);
return $data;
}
echo rainbow('this is a test with [rainbow]rainbow colors[/rainbow] and more text');
?>
thats not to say it can't be done.
truely i dont see any issues with the color randomly changing on a new page refresh anyway.
and from what i can see from other posts all the functions would randomly change the color anyhow.Last edited by Ghost; 22.02.14, 17:34.<?php
include ('Ghost');
if ($Post == true) {
echo '
sigpic
alt='coding-talk.com!!' />';
echo 'Sharing Is Caring!';
} else {
echo '
alt='the username GHOST has been comprimised!' />';
echo 'OMG SOMEBODY HELP ME!!';
}
?>
Comment
Comment