Multi value in php

Discussion in 'PHP' started by aCebOy, Jun 16, 2013.

  1. #1
    Hello Dear Php Experts, I Need Some Help, Look,
    $key = "2a587s45";

    I Want to add more keys randomly, look,

    here some keys, 25d25484d2 | 58s8ee2d6dd5 | yycd8fgg1 | 2a587s45
    I want to add these in $key = randomly
    Any Idea ?
     
    Solved! View solution.
    aCebOy, Jun 16, 2013 IP
  2. #2
    $list = array("one", "two", "three");
    $random_item = $list[rand(0, count($list) - 1)];
     
    echo $random_item;
    PHP:
    If those keys come as a string:
    $keys = "25d25484d2 | 58s8ee2d6dd5 | yycd8fgg1 | 2a587s45";
    $list = explode(" | ", $keys);
    $random_item = $list[rand(0, count($list) - 1)];
     
    echo $random_item;
    PHP:
     
    ActiveFrost, Jun 16, 2013 IP
  3. HuggyStudios

    HuggyStudios Well-Known Member

    Messages:
    724
    Likes Received:
    20
    Best Answers:
    26
    Trophy Points:
    165
    #3
    HuggyStudios, Jun 16, 2013 IP
  4. aCebOy

    aCebOy Banned

    Messages:
    68
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    36
    #4
    ThaNks, And any idea about line wise ?
    1st 25d25484d2 show, then 58s8ee2d6dd5 after that yycd8fgg1 and last 2a587s45 ..
     
    aCebOy, Jun 17, 2013 IP
    BinkyM likes this.
  5. Rajeev Reddy G

    Rajeev Reddy G Greenhorn

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    As they are Randomly generated Strings ... we cannot make the desired random numbers in an order !!!
     
    Rajeev Reddy G, Jun 19, 2013 IP