I would like to ask my friends: the meaning of a piece of PHP code

<div class="aw-mod aw-topic-bar" id="question_topic_editor" data-type="question" data-id="<?php echo $this->question_info["question_id"]; ?>">
<div class="tag-bar clearfix">
<?php foreach($this->question_topics as $key => $val) { ?>
<span class="topic-tag" data-id="<?php echo $val["topic_id"]; ?>">
<a href="topic/<?php echo $val["url_token"]; ?>" class="text"><?php echo $val["topic_title"]; ?></a>
</span>
<?php } ?>

<?php if ($this->user_id AND ((!$this->question_info["lock"] AND $this->user_info["permission"]["edit_topic"]) OR $this->user_id == $this->question_info["published_uid"])) { ?><span class="icon-inverse aw-edit-topic"<?php if (sizeof($this->question_topics) == 0) { ?> style="display:none"<?php } ?>><i class="icon icon-edit"></i></span><?php } ?>
</div>
</div>

how do you understand the question_topics as $key = > $val) {? > code in this code? Where did you go through? Is question_topics a field? What does the underscore in front of _ topics mean? What does question stand for? Can you remove the curly braces inside?

Php
Mar.08,2022

can only be written in V of MVC . The whole traversal section is as follows

<?php foreach($this->question_topics as $key => $val) { ?>
<span class="topic-tag" data-id="<?php echo $val['topic_id']; ?>">
<a href="topic/<?php echo $val['url_token']; ?>" class="text"><?php echo $val['topic_title']; ?></a>
</span>
<?php } ?>

traverses the array $this- > question_topics . In the template engine, the html part is output directly. The following code actually writes the variables of PHP into the HTML code

.
<span class="topic-tag" data-id="<?php echo $val['topic_id']; ?>">
<a href="topic/<?php echo $val['url_token']; ?>" class="text"><?php echo $val['topic_title']; ?></a>
</span>

if you change the entire traversal to PHP code like this, the result will be the same

<?php
foreach($this->question_topics as $key => $val) { 
    echo "<span class=\"topic-tag\" data-id=\"{$val['topic_id']}\">
            <a href=\"topic/{$val['url_token']}\" class=\"text\">{$val['topic_title']}</a>
          </span>
    ";
}
?>

question_topics is a variable name, and _ is used to split two words, so that the segmentation is to improve readability. You can see the meaning of the variable by the variable name

at a glance.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e5b36c-4560c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e5b36c-4560c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?