ive been looking a little at ASP, and i saw something that reverses what you input.
i wanted to see if this could be done, but ive been racking my brain, and had no luck
is there a way to reverse a string in PHP?
Don't rack brain, just read manual.
http://www.php.net/strings
There is a rich set of string-handling functions, including strrev().
strrev(); check the manual.
ohh, cool
i almost never read the manuals, and do things the prehistoric way: experiment
thanx
the php manual is very good. you should always check it out before asking questions, because 90% of the time the manual will point you in the right direction. 😉
ok...
even though i like learning things myself, because i remember it in an easier fashion
new question:
how can you do a 'hack' affect?
Example: HeLlO tHiS iS dXl
can you do that more easily than typing it? #note: i dont see it on http://www.php.net/strings
look up str_replace (on that same page)
A simplistic function for that might be:
function hackStr($str) { $str = strtolower($str); $len = strlen($str); for ($i = 0; $i < $len; $i += 2) { $str{$i} = strtoupper($str{$i}); } return $str; }
not sure how to optimise it, though.
function hackStr($str) { $str = strtolower($str); $len = strlen($str); $i=0; while ($i<$len) { $str{$i} = strtoupper($str{$i}); $i=$i+rand(1,4); } return $str; }
That might work slightly better...