Hi,
I want to access the contents of this particular array :
Array
(
[0] => Array
(
[test] => test1
[test2] => test2
)
[1] => Array
(
[test] => test1
[test2] => test2
)
)
I want to use foreach loop but i dont know how to access the elemens of this kind of array. I have tried a lot but couldnt find any way
Moreover i want to serialze the array
[values] => Array
(
[0] => Array
(
[val1] => val1
[val2] => val2
)
)
i have serialized it using php function serialize on values array but it returns null. Can anyone tell how to do this??
How to access array contents and serialize data
Moderator: General Moderators
-
new_member
- Forum Newbie
- Posts: 8
- Joined: Sat Sep 28, 2013 12:49 am
Re: How to access array contents and serialize data
Code: Select all
foreach ($array as $item) {
echo $item['test'];
echo $item['test2'];
}Code: Select all
$foo = serialize($bar)-
new_member
- Forum Newbie
- Posts: 8
- Joined: Sat Sep 28, 2013 12:49 am
Re: How to access array contents and serialize data
i am using simply
serialize($this->values)
printing $this->values gives correct array values but serializing giving empty results
serialize($this->values)
printing $this->values gives correct array values but serializing giving empty results
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: How to access array contents and serialize data
Why are you serializing it?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.