-1

I have some values:

$data1
$data2
$data3

I want to concatenate these variables and then perform an md5 calculation how is it done??

user342391
  • 7,077
  • 23
  • 62
  • 88

4 Answers4

7
echo md5($data1.$data2.$data3);

Related:

Gordon
  • 305,248
  • 71
  • 524
  • 547
Pekka
  • 431,103
  • 135
  • 960
  • 1,075
2
md5($data1 . $data2 . $data3);
hudolejev
  • 5,535
  • 4
  • 21
  • 27
1

If your values are strings it's pretty easy

md5($data1 . $data2 . $data3);

If they are not string you need to first convert them.

RaYell
  • 68,096
  • 20
  • 124
  • 150
1

If your vars are no simple strings, but maybe objects or arrays you could go like this:

md5(serialize($data1 . $data2 . $data3));
faileN
  • 92
  • 1