Answers for "LOOP through object in php"

1

php loop through object

foreach ($obj as $key => $value) {
    echo "$key => $valuen";
    //echo "test greper";
}
Posted by: Guest on May-11-2021
0

php loop through objects

foreach ($obj as $key => $value) {
    echo "$key => $valuen";
}
Posted by: Guest on November-04-2020
-1

loop through object php

<?php
class MyClass 
{
  public $var1 = 'valeur 1';
  public $var2 = 'valeur 2';
  public $var3 = 'valeur 3';

  protected $protected = 'variable protégée';
  private   $private   = 'variable privée';

  function iterateVisible() {
     echo "MyClass::iterateVisible:n";
     foreach ($this as $key => $value) {
         print "$key => $valuen";
     }
  }
}

$class = new MyClass();

foreach($class as $key => $value) {
    print "$key => $valuen";
}
echo "n";


$class->iterateVisible();
Posted by: Guest on March-29-2020

Code answers related to "LOOP through object in php"

Browse Popular Code Answers by Language