Simply do not get why PHP won';t convert each valuye of every key of an array into another array..... so that if I access say $userinfo[0][0] it gioves me the first username say.

users.txt is set up as follows user1 pass1|user2 pass2 etc etc


<?php
//set variables for this script
$filename = "users.txt";


//open file
$handle = fopen($filename, "r");
//put contents of file into a string
$content = fread($handle, filesize($filename));
fclose($handle);

//create the main Array

$userinfo = explode("|", $content);

//foreach element create a seperate array

foreach ($userinfo as $k => $v) {
$v = explode(" ", $v);

}


echo "<pre>";
print_r($userinfo);
echo "</pre>";
?>

just doesnt give the wanted output!

    foreach ($userinfo as $k => $v) { 
        $userinfo[$k] = explode(' ', $v);
    }
      Write a Reply...