loop over keys and values php
foreach ($arr as $key => $value) {
echo $key;
}
loop over keys and values php
foreach ($arr as $key => $value) {
echo $key;
}
php loop object
<?php
class MyClass
{
public $var1 = 'value 1';
public $var2 = 'value 2';
public $var3 = 'value 3';
protected $protected = 'protected var';
private $private = 'private var';
function iterateVisible() {
echo "MyClass::iterateVisible:\n";
foreach ($this as $key => $value) {
print "$key => $value\n";
}
}
}
$class = new MyClass();
foreach($class as $key => $value) {
print "$key => $value\n";
}
echo "\n";
$class->iterateVisible();
?>
php loopthrough object
foreach ($objects as $obj) {
echo $obj->property;
}
php loop object keys
echo $obj->name;
echo $obj->age;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us