How to operate on the array elements of a specific key name, for example, if I have an array retrieved from the database, the key name field name directly outputs this array element to the table; just use foreach, but I want to set all the elements of a specific key name. for example, all the elements of an array whose key name is userid & nbsp; are there any ways to add hyperlinks and output them on the table .. how to operate on array elements with specific key names
For example, I have an array extracted from the database. The key name is the field name.
Output the array element directly to the table. I will use foreach.
However, I want to add hyperlinks to all elements with specific key names, such as all array elements with key names 'userid '.
And then output it to the table.
Is there a solution ..
Share:
------ Solution --------------------
Isn't it the same? you just need to add a link to the output.
------ Solution --------------------
Foreach ($ arr as $ key => $ value ){
If ($ key = "userid "){
Echo "". $ key ."";
}
}
------ Solution --------------------
Your code has no syntax errors. can it not be displayed, or is it not what you need?
------ Solution --------------------
For example, if the array you read is in $ row
$ Row ['userid'] = "$ row [userid]";
Then foreach
------ Solution --------------------
Foreach ($ arr as $ v ){
Echo "'". $ v ['userid']. "'";
}