0
<?php
header('Content-type: application/json');
$arr = array('success' => true, 'key' => "random", 'valid_until' => "2020-12-23 23:38:53", 'pid' => LssBot, 'token' => "QmBLOJmCRWe+jdVyKKSUJaxtMDPloLFyuQ490USkRQSFxEiBMjzsjd+34IoxryTVw7OZH8p7zY4vdewkyML5oLe75VchNTaWTS6OUPCDaPEM+nevz\/3n9NBv+v2mm\/C2YamlApCPhR+vJm376MFKYuNZz1CqUgt5LhEG3lgAOHHlqydS5tBc1L\/0VrnHuvWzClCUcrQ31s9Igo2C2+g\/LosARCqSIZB+1x9nOiFhiSKYKPqzEbHXwZybEhX7ztQ63U0bQEG6k0qHl+PObkR8ap7qHXDjrj2Dh5BVOe5jVQZC19qt8NQ9qlnxfqOqPIKaC\/2fLrWCJAGpfxanltNuXW+HXAnulrTDKrO430tbwR0=", 'r' => "b22831623da8b1e20a76376f057455da", 'xt' => "2");

echo json_encode($arr);

?>

I want to randomize the key's value 'key' => "random" as 32 random numbers

SherylHohman
  • 14,460
  • 16
  • 79
  • 88
  • With `rand` or similar function? – u_mulder Dec 25 '19 at 16:20
  • @u_mulder anything that can randomize this array vaule – Mohamed Abdel Fattah Dec 25 '19 at 16:25
  • You mean how to generate a random string? see: https://stackoverflow.com/questions/4356289/php-random-string-generator – Ali Khalili Dec 25 '19 at 17:58
  • @AliKhalili yes fixed from 30min xD the same soulotion ` "$r", 'xt' => "2"); echo json_encode($arr); function generateRandomString($length = 32) { $characters = '0123456789abcdef0123456789'; $charactersLength = strlen($characters); $randomString = ''; for ($i = 0; $i < $length; $i++) { $randomString .= $characters[rand(0, $charactersLength - 1)]; } return $randomString; }` – Mohamed Abdel Fattah Dec 25 '19 at 18:16
  • Why do you want to randomise keys? If you are after something unique, try Php's `uniqid()`, it's made for that. – Progrock Dec 27 '19 at 11:51

0 Answers0