Base64 decode

Discussion in 'PHP' started by karkajoi, 1 Dec 2020.

  1. karkajoi

    karkajoi Well-Known Member

    Joined:
    26 Oct 2016
    Messages:
    488
    Likes Received:
    459
    Reputations:
    8
    Доброго времени суток.
    В пхп не силен, поэтому прошу помощи.
    Есть исходные строки

    Слово:base64(string)
    Слово:base64(string)
    Слово:base64(string)

    Надо сделать вывод

    base64(string):base64_decode(string)
    base64(string):base64_decode(string)
    base64(string):base64_decode(string)

    Либо

    Слово:base64(string):base64_decode(string)
    Слово:base64(string):base64_decode(string)
    Слово:base64(string):base64_decode(string)
     
  2. crlf

    crlf Green member

    Joined:
    18 Mar 2016
    Messages:
    683
    Likes Received:
    1,513
    Reputations:
    460
    PHP:
    $arr = ['test:MTEx','root:MjIy','toor:MzMz'];
    //$arr = file('file.txt', FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);

    foreach($arr as $str)
       echo 
    $str.':'.base64_decode(trim(strstr($str':'),':')).PHP_EOL;