Reputation: 55
Here is my code:
foreach ($results as $result)
{
$getdata[] = $result->salt;
$getdata[] = $result->password;
}
var_dump($getdata);
echo $sal->$getdata[0];
echo "<br>";
echo $pwd->$getdata[1];
Output:
array(2) { [0]=> string(3) "f9e" [1]=> string(64) "61eed489ddfa309ab764hj876bfhfa5d18e3c3e695edc15" }
But i want the ouput like dis:
[0]=> "f9e" [1]=> "61eed489ddfa309ab764hj876bfhfa5d18e3c3e695edc15"
Upvotes: 1
Views: 138
Reputation: 8168
Before printing the result, use
echo "<pre>";
print_r($result);
This will give you result in a neat understandable way
FYI:
The var_dump
function displays structured information about variables/expressions including its type and value
The print_r()
displays information about a variable in a way that's readable by humans. array values will be presented in a format that shows keys and elements
Upvotes: 0
Reputation: 1
Please try following code:
foreach ($results as $result) {
$getdata[] = $result->salt;
$getdata[] = $result->password;
}
foreach ($getdata as $key => $value) {
echo '[' . $key . '] => "' . $value . '" ';
}
Upvotes: 0