“PHP Loop melalui Daftar” Kode Jawaban

PHP Loop melalui Daftar

for ($i = 0; $i < count($array); $i++) {
    echo $array[$i]['filename'];
    echo $array[$i]['filepath'];
}
Clever Cardinal

PHP Loop melalui Daftar

foreach($array as $item) {
    echo $item['filename'];
    echo $item['filepath'];

    // To know what's in $item
    echo '<pre>'; var_dump($item);
}
Liyang Yu

php foreach

<?php
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43");

foreach($age as $x => $val) {
  echo "$x = $val<br>";
}
?>
Mohammadali Mirhamed

PHP Array Loop

foreach($array as $item) {
    echo $item['filename'];
    echo $item['filepath'];

    // to know what's in $item
    echo '<pre>'; var_dump($item);
}
Clever Cardinal

array loop php

/**
 * Get the author of the post.
 */
public function user()
{
    return $this->belongsTo(User::class)->withDefault([
        'name' => 'Guest Author',
    ]);
}

/**
 * Get the author of the post.
 */
public function user()
{
    return $this->belongsTo(User::class)->withDefault(function ($user, $post) {
        $user->name = 'Guest Author';
    });
}
Envious Elephant

Jawaban yang mirip dengan “PHP Loop melalui Daftar”

Pertanyaan yang mirip dengan “PHP Loop melalui Daftar”

Lebih banyak jawaban terkait untuk “PHP Loop melalui Daftar” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya