Forum Moderators: coopster
4152390867
and jumble it beyond recognition but still be able to decrypt it. IOW, say every instance of
0=8
1=3
2=5
3=7
4=1
5=2
6=9
7=4
8=6
9=0
so if variable
$orignum=4152390867
How could I create a simple function to pass $orignum to the function and turn it into:
$orignum=1325708694
and then when I need the original number back for the function to return it to it's original?
Thanks.
Why
$numout="";
and
return $numout;
?
I would have probably just made sure there is no variable called $numout in the data, done a
global $numout;
and that's it...but wondering if my way is a security issue? Or a worse way?
Also, will I then be able to use $numout anywhere after I call the function or do I need to call the function a special way to access it?
Sorry, I know these are dummy questions but I get confused on functions and globals vs locals sometimes...
This way just do:
$myvar=Scramble(123456789);
then you could do:
$test2=Scramble(768574656);
If you did it with global vars the second call would clear out the first.
As for setting the var to "" first I have a C background and it's been ingrained into me to _always_ initialize variables to a known state. In PHP I don't think this is required but I like to do it anyway :)
daisho.
I digress..anyways, I didn't look at your code in detail yet, I will after I finally get my coffee and when I go back and try and implement it, but does it decrypt *as well as* encrypt? Or do I have to make an opposite function to decrypt?