foreach loop array php
foreach (array as $value){
//code to be executed;
print("value : $value");
}
foreach (array as $key => $value){
//code to be executed;
print("key[$key] => $value");
}
foreach loop array php
foreach (array as $value){
//code to be executed;
print("value : $value");
}
foreach (array as $key => $value){
//code to be executed;
print("key[$key] => $value");
}
php foreach count rows
<?php
$count = 0;
foreach( $names as $name){
$count = $count + 1;
echo "<td>".$count. "</td>
"<td>".$name. "</td>";
}
echo $count;
?>
php wpdb foreach
get_header();
function get_records()
{
//$con=connectsql();
$records=$wpdb->query("SELECT * FROM $wpdb->posts WHERE post_type = 'elements' AND post_status = 'publish'");
$all=array();
while($data=$records->fetch_assoc())
{
$all[]=$data;
}
return $all;
}
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