Hi everyone
I know that some people at this site getting nervous about program request or code request for any reason but i have to did it to friday.I have no php knowledge except making php forum with macromedia dreamviewer .I have to write or find a php code that makes random table like
1 8
2 7
h x

by using this table i have to get some string input and replace 1 with 8 2 with 7 and h with x etc... if they are in my input string.

This program have to create table with only one 2 in left places and one 2 in the right place of table ,also these table has to have all letter from english alphabet + 0,1,2,3,4,5,6,7,8,9 numbers.

If somebody help me for writing this code or if somebody already have it or have code like that , i will be very grateful for that...
If i have to do it in a 2 weeks i can do it only myself but i have only 3 days to deadline.

Have a nice day...

Recommended Answers

All 3 Replies

Does not look trivial. May be you need to contact a freelancer.

so you want it to make this random table every time the php is ran ? this would make anything stored completely irritrievable ?

It is quite trival but I not keen on doing peoples coursework for them because they don't learn anything from it but!

function encode()
{
   $master_array =    array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',1,2,3,4,5,6,7,8,9,0);

    //Initalise the return array
   $ecode_array=array();
    //Create a copy of the master array 
    $delete_array = $master_array;

//Loop through the master array
    for($i=0;$i<count($master_array);$i++)
   {
      //Create a random number between 0 and the length of the delete_array
      $random_number = mt_rand(0,count($delete_array);      
/
/Create a 2D array that stores the true value and the encrypted value.
$ecode_array[]=array($master_array[$i],$delete_array[$random_number]);

//Delete the encrypted value from the delete array so thatwe ensure that we have a unique encryption
   unset($delete_array[$random_number];
}
return $ecode_array;
}

$encoded_array = encode();
print_r($encoded_array);

echo "Now Value ".$encoded_array[0][0] ."has been converted to ".$encoded_array[0][1]; 

I have not tested this function so I don't know how well it works but hopefully it might give you have idea of what you could do.

Bestregards,

Urban

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.