for each key value php code example
Example 1: php foreach echo key value
foreach($page as $key => $value) {
echo "$key is at $value";
}
Example 2: loop through values of hash php
foreach ($array as $key => $val) {
print "$key = $val\n";
}
Example 3: foreign key in php
CREATE TABLE Orders (
OrderID int NOT NULL,
OrderNumber int NOT NULL,
PersonID int,
PRIMARY KEY (OrderID),
CONSTRAINT FK_PersonOrder FOREIGN KEY (PersonID)
REFERENCES Persons(PersonID)
);
Example 4: php ofreach
<?php
$a = array(1, 2, 3, 17);
foreach ($a as $index => $v) {
echo "Current value of \$a: $v.\n";
}
?>