base64 encode question
| From: | Sn!per | Date: | Thu, 03 Apr 2008 07:53:53 +0000 |
| Subject: | base64 encode question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-272474@lists.php.net to get a copy of this message | ||
Hi all, I have a short script that I want to store the last login time and the host IP number (harcoded for the moment). Those two variables are stored in $last_login, which is an array.
[root@svr1 test]# cat lt.php
<?
$last_login = array('time' => time(), 'host' => "192.168.10.100");
$serialize_last_login = serialize($last_login);
print "$serialize_last_login\n";
$encoded_serialize_last_login = base64_encode($serialize_last_login);
print "encoded value is: $encoded_serialize_last_login\n\n";
?>
[root@svr1 test]#
When I ran the script, I can see that $serialize_last_login have different value for 'time'. But why does $encoded_serialize_last_login always show the same value? Below is the output after running the script for 3 times:
[root@svr1 test]# php lt.php
a:2:{s:4:"time";i:1207208982;s:4:"host";s:14:"192.168.10.100";}
encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4MjtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9
[root@svr1 test]# php lt.php
a:2:{s:4:"time";i:1207208984;s:4:"host";s:14:"192.168.10.100";}
encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NDtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9
[root@svr1 test]# php lt.php
a:2:{s:4:"time";i:1207208985;s:4:"host";s:14:"192.168.10.100";}
encoded value is: YToyOntzOjQ6InRpbWUiO2k6MTIwNzIwODk4NTtzOjQ6Imhvc3QiO3M6MTQ6IjE5Mi4xNjguMTAuMTAwIjt9
Please help
--
Roger
--
Sign Up for free Email at http://ureg.home.net.my/