Humble Cuber
Veteran
Hi, I am currently trying to make my own speedcubing timer website, I already have the stopwatch design down for the timer itself, but I've been having some trouble with creating a random string generator via PHP for the scrambles the problem is that those different variables are being pushed together, so rather than a normal looking scramble it comes out looking something like this "R22UB2BU2R"
this is the current code I have, if you can please give me some help on how to make each piece of notation a separate variable that would be greatly appreciated.
<?php
function = ranSrtGen(){
}
$result = "";
$chars = "R B U L F D R2 B2 U2 L2 F2 D2";
$charArray = str_split($chars);
for($i = 0; $i < 18; $i++){
$randItem = array_rand($charArray);
$result .= "".$charArray[$randItem];
}
echo $result
?>
this is the current code I have, if you can please give me some help on how to make each piece of notation a separate variable that would be greatly appreciated.
<?php
function = ranSrtGen(){
}
$result = "";
$chars = "R B U L F D R2 B2 U2 L2 F2 D2";
$charArray = str_split($chars);
for($i = 0; $i < 18; $i++){
$randItem = array_rand($charArray);
$result .= "".$charArray[$randItem];
}
echo $result
?>
