Finding PHP Programs Inverting String Detailed Comments!

Updated on technology 2024-04-19
11 answers
  1. Anonymous users2024-02-08

    Hello landlord.

    It's a bit winding with recursion, but you can actually use a loop to reverse the string.

    function strr($str)

    count = strlen($str);

    for ($i = $count-1; $i >= 0; $i--)

    echo substr($str, $i, 1);

    strr("qingming");

    If you have to use recursive calling, let me help you analyze it briefly.

    function upand($str){

    if(strlen($str)>0)

    upand(substr($str,1));

    echo substr($str,0,1);

    return;

    upand(lixinghua);

    , the first call to upand("lixinghua"), because strlen($str)>0 performed recursion again with upland("ixinghua"), and the echo below has no output yet. 、

    The second call to upand("ixinghua"strlen($str) is still greater than 0, so recursively upland("xinghua"),。

    The nth call to upand("a"), and repeat until strlen($str)=0, i.e. upand(""), start to execute the echo statement, because all the previous upand echo was not executed, so it was executed one level at a time. . .

    So output from the last bit. In this case, the reverse execution is done: upand("a"),upand("ua"),upand("hua")..** that is not completed.

  2. Anonymous users2024-02-07

    if(strlen($str)>0) executes the following function only if the character length is greater than 0.

    upand(substr($str,1));

    echo substr($str,0,1);

    return;

    This is a recursive function. Not tested. But see upand(lixinghua); It should be upand("lixinghua");

    For more information on the use of the function substr, please see.

  3. Anonymous users2024-02-06

    Your s is not an array, s[i] what's the situation at this time, are you sure your program can run?

    The assignment of arrays is not a simple sentence ** that can be assigned to s=;

    int t = 0;The value of t is 0

    string s;

    s= ;The value of s is the value of t converted to a string, which is "0".

    for (int i = - 1; i >= 0;i--) is 1, and subtracting one is 0, and this cycle is conditional.

    static void main(string args)

    Method 2: for loop for (int i = 0; i < i++)ps

    I've been looking for a long time.,The console hasn't been used for a long time.,**Personal feeling on it is similar to your**The function you want to achieve。

    Hope it helps.

  4. Anonymous users2024-02-05

    int t = 0;Assign a value to the integer t. But it's equal to 0 and has no use value, right? If it's equal to 1234, then you can see the result.

    string s;define the string variable ss=; Convert t to a string and assign a value to s. If t=1234, then s="1234"

    for (int i = - 1; i >= 0;i--) Hold the console window and wait for keyboard input.

  5. Anonymous users2024-02-04

    If you're sure that this ** is working, then s=; According to normal logic, it should be to convert characters into arrays.,But I really don't understand your t variable.,How do I look at this**The more wrong it is?,Is it necessary to be so entangled?,There's a way to output the string in reverse order!

  6. Anonymous users2024-02-03

    Recycle to for strlen

    Then the string takes the value of $str, $str

    No idea about recursion, recursion back who said.

  7. Anonymous users2024-02-02

    If you just want to put the characters in a string backwards, you can use the strrev() function.

  8. Anonymous users2024-02-01

    This should be the initial file for "some" framework! (dot plot enlarged).

  9. Anonymous users2024-01-31

    It's not enough to look at the manual for each function.

  10. Anonymous users2024-01-30

    There's nothing to explain about this.

    The first function, example, inverts the string.

    The second function, num, returns the value of the nth Fibonacci amount.

  11. Anonymous users2024-01-29

    <% if(goods >0){% to determine whether the goods list has a value.

    for(i=0;i-loop array goods list<%=goods list[i].goods_id;%> outputs the value of goods id with the subscript i (0 for the first time, cumulative for the subsequent period), multidimensional arrays, e.g. goods[0] when i is 0]['goods_id'] value.

    The output is the same for the rest of the world.

    if (goods_list[i].is_virtual == '1'{Determine if the value of is virtual is 1.}

Related questions
14 answers2024-04-19

The specific program has been sent to you via a message on the site. Test it out for yourself. >>>More

8 answers2024-04-19

Error file, basically useless, so don't open it.

8 answers2024-04-19

It's really hard to say casually if you haven't done this. You can try using the comparevalidator control, but this control compares the values of two text boxes, one character at a time. You need to write your own ** transformation.

8 answers2024-04-19

The if statement is still very fast to execute, and it doesn't need to be optimized.

13 answers2024-04-19

Look it up and read Zheng Shen's "BC High Cluster Chain Accuracy Respect Function Library". >>>More