Correcting a piece of code, expert advice

Source: Internet
Author: User
Modify a piece of code, expert advice
$char = "111112222233333";
Preg_match_all ("| (. *)| U ", $char, $out, Preg_pattern_order);
echo $out [0][0];
echo $out [0][1];
echo $out [0][2];



The above code can get the value between the strings, but the effect I want is

I don't know how many nnnnn there are in the string, I want to get all the values between all the div and shuffle the order randomly.
such as the string "11111222223333344444";
The result I want to get is: 22222444443333311111


Trouble to know the master directly to the complete code, thank you

share to: more


------Solution--------------------

$char = "111112222233333";
Preg_match_all ("
------Solution--------------------
(.*)
------Solution--------------------
U ", $char, $out, Preg_pattern_order);

Shuffle ($out [0]);
$s = join ("', $out [0]);
Echo $s;
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.