I have two problems.
1)I have a system wich has a form. when the user enter a message from the web interface it will be saved with a variable. Ex: $Customername = $_POST['Customer_name']; . What i want to know is a way to save this into an array of charcters by using Ex: $Customername. then it will be compared with another set of characters.
2) this is very much related to the above question.I am trying to compare two arrays. it works but it dose not echo out the order according to the variable $array1;
seems to me it is brinting according to the alphebatical order. I want to stop that and want to print the result according to the $array1.
the output is : BBCD. but it has to be BDCB.
Code: Select all
<?php
$array1=array('A','C','B','A');
$array = array('A'=>'B','B'=>'C','C'=>'D');
foreach($array as $key=>$value){
for($i=0;$i<count($array1);$i++){
if($array1[$i]==$key){
echo"$value";
}
}
}
?>