How to manipulate an array element of a particular key name

Source: Internet
Author: User
How to manipulate an array element of a specific key name
For example, I have an array taken out of the database, the key name is the field name
Output this array element directly to the table. I'll just use foreach.


But I want to add hyperlinks for all elements of a particular key name, such as all array elements with the key name ' UserID '
And then output it on the table.
Is there a way?

Share to:


------Solution--------------------
Not the same, you add the link when you output it.
------Solution--------------------
foreach ($arr as $key = = $value) {
if ($key = = "UserID") {
echo "". $key. "";
}
}
------Solution--------------------
Do you have this code that doesn't have syntax errors, doesn't show up, or doesn't show what you're looking for?

------Solution--------------------
Very simple, such as the array you read in the $row, then
$row [' userid '] = "$row [userid]";
And then foreach.
------Solution--------------------

foreach ($arr as $v) {
echo "'". $v [' userid ']. "'";
}
  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.