I am trying to create a condition in php like given below-
$variable = "132";
if($variable == "123"){
echo "Matched.";
}else{
echo "Not Matched.";
}
I want to show Matched in this condition, cause these two values are same character.
I am trying to create a condition in php like given below-
$variable = "132";
if($variable == "123"){
echo "Matched.";
}else{
echo "Not Matched.";
}
I want to show Matched in this condition, cause these two values are same character.
Thank you so much, finally i got my answer-
$variable = "1432";
$var = str_split($variable);
sort($var);
if(implode("", $var) == "1234"){
echo "Matched.";
}else{
echo "Not Matched.";
}
I would split the strings into the constituent characters and do array_diff on them.
$variable = str_split("132");
$variable_2 = str_split("123");
var_dump( array_diff($variable, $variable_2));
if(count(array_diff($variable, $variable_2)) == 0){
echo "Matched.";
}else{
echo "Not Matched.";
}