I have following array, I want to retrieve name
, comment
and each of the tags
(to insert in database. How can i retrieve the array values. Also, can i filter ONLY the tags values which are larger than 3 characters and contains only a-Z0-9 valueus. Thank you very much.
Array
(
[folder] => /test
[name] => ajay
[comment] => hello world.. test comment
[item] => Array
(
[tags] => Array
(
[0] => javascript
[1] => coldfusion
)
)
)
$name = $array['name'];
$comment = $array['comment'];
$tags = $array['item']['tags']; // this will be an array of the tags
You can then loop over the tags like:
foreach ($tags as $tag) {
// do something with tag
}
Or access each one individually
echo $tags[0];
echo $tags[1];
$name = $array['name'];
echo $name; // ajay
$comment = $array['comment']
echo $comment; //hello world.. test comment
$tags = $array['item']['tags'];
echo $tags[0]; // javascript
echo $tags[1]; // coldfusion
http://www.php.net/manual/en/language.types.array.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With