$char = "111112222233333";p Reg_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
Reply to discussion (solution)
Added: There are Chinese characters between the Div
$char = "111112222233333"; $ary = Explode (", $char); shuffle ($ary); foreach ($ary as $v) {echo". $v;}
$char = "111112222233333";
$ary = Explode (' ', $char);
Shuffle ($ary);
foreach ($ary as $v)
{
if ($v! = "") {
Echo '. $v;
}
}
Upstairs the addition of a judgment value is not empty better point, the array will be more than one loop, followed by a more
Thank you upstairs two elder brother, this is a cycle
So how do you put this value back in a string?
For example $char1 = ' '
Code should be how to write, the younger brother does not understand PHP, again trouble, thank you
$char = "111112222233333";p Reg_match_all ("| (. *)| U ", $char, $out, Preg_pattern_order); Shuffle ($out [0]); $s = Join (", $out [0]); Echo $s;
By
Use the code on the 5 floor.
$char = "111112222233333";p Reg_match_all ("| (. *)| U ", $char, $out, Preg_pattern_order); Shuffle ($out [0]); $char = Join (", $out [0]); Echo $char;