0
Q:

array key value php

<?php 
// PHP function to illustrate the use 
// of array_key_exists() 
function Exists($index, $array) 
{ 
    if (array_key_exists($index, $array)){ 
        echo "Found the Key"; 
    } 
    else{ 
        echo "Key not Found"; 
    } 
} 
  
$array = array("ram"=>25, "krishna"=>10,  
                "aakash"=>20, "gaurav"); 
$index = "aakash"; 
print_r(Exists($index, $array)); 
?> 
3
$healthStructureData = [
            'product' => $product,
            'website_data' => $website_data,
            'total_keywords' => $total_keywords,
            'certificate_status' => $certificate_status,
            'total_user_websites' => $total_user_websites,
        ];

foreach ($healthStructureData as $key => $value) {
  $$key = $value;
}
1
<?php
$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43");
foreach($age as $x=>$x_value)
  {
  echo "Key=" . $x . ", Value=" . $x_value;
  echo "<br>";
  }
?>
3
array_keys ($array);
// It returns an array
// more informations at https://www.php.net/manual/fr/function.array-keys.php (fr)
0
foreach($bigArray as $array){    
    foreach($array as $key=>$value){
        echo $key;
    }
}


#If if helps you give it Thumbs up
0
$array = array(0 => 100, "cor" => "vermelho");
print_r(array_keys($array));

$array = array("azul", "vermelho", "verde", "azul", "azul");
print_r(array_keys($array, "azul"));

$array = array("cor"     => array("azul", "vermelho", "verde"),
               "tamanho" => array("pequeno", "medio", "grande"));
print_r(array_keys($array));
0

 <?php array(); ?>
 
0

New to Communities?

Join the community