Where to go online written Chinese word breaker program
Took part in the written test of where to go net
The main idea: Asp.php.jsp.javascript language is not limited to convert it into javascript.jsp.php.asp
This means that the user enters a string that contains a number of "." Separated characters), you write a program implemented with these "." For the separation, turn the original sentence upside down.
Reply to discussion (solution)
Looks like the conversion of the group, and then the reverse is possible.
The question is how to implement the "." To separate it? The conversion of a character between two points into an array cell. Great God Solution
Looks like the conversion of the group, and then the reverse is possible.
The question is how to implement the "." To separate it? The conversion of a character between two points into an array cell.
$s = ' asp.php.jsp.javascript '; Echo join ('. ', Array_reverse (Explode ('. ', $s)));
Javascript.jsp.php.asp
$s = ' asp.php.jsp.javascript '; Echo join ('. ', Array_reverse (Explode ('. ', $s)));
Javascript.jsp.php.asp
Moderator Big God thick line, it seems that my PHP has to learn! Sheida!
If you are not the kind of "repeated war" type, suggest or more practice for a period of time to go to the interview good, or you will always face failure to fight their confidence
That's the basics, right?
is expected to be implemented with non-system self-brought functions.
That's the basics, right?
Well, it was actually a struggle to write a function or something.
is expected to be implemented with non-system self-brought functions.
Well, that was the idea.
If you are not the kind of "repeated war" type, suggest or more practice for a period of time to go to the interview good, or you will always face failure to fight their confidence
NN Thank you!
Non-system comes with a function to achieve, do not array_reverse, you can write it.
function Reverse_str ($s) {$r =explode ('. ', $s); $c =count ($r); $i =0;foreach ($r as $k + $v) {if ($i < $c/2) {$r [$k]= $r [$ c-1-$i];//The first key value is equal to the last value $r[$c-$i]= $v;//The last key value equals the first value, and so on the interchange key value $i++;} Else{break;}} return join ('. ', $r);} Test $s= "1.2.3.4.5.6"; Echo reverse_str ($s);
Hope to help you.
Non-system comes with a function to achieve, do not array_reverse, you can write it.
function Reverse_str ($s) {$r =explode ('. ', $s); $c =count ($r); $i =0;foreach ($r as $k + $v) {if ($i < $c/2) {$r [$k]= $r [$ c-1-$i];//The first key value is equal to the last value $r[$c-$i]= $v;//The last key value equals the first value, and so on the interchange key value $i++;} Else{break;}} return join ('. ', $r);} Test $s= "1.2.3.4.5.6"; Echo reverse_str ($s);
Hope to help you.
Well, string processing is a very important part of web development. 3Q