Webbanditten

Untitled

Aug 10th, 2020
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <?php
  2. //Enter your code here, enjoy!
  3.  
  4. // I princippet headings
  5. $headings = array("foo" => "bar", "blabla" => 89009, "id" => "imtheid");
  6.  
  7. // Hvis headings har en key med id så lad os sætte en variable og fjerne key & value fra nuværende array
  8. if($headings["id"]) {
  9. $temp_id = $headings["id"];
  10. unset($headings["id"]);
  11. $headings = array_merge(["key1" => $temp_id], $headings);
  12. }
  13.  
  14.  
  15. foreach( $headings as $key => $value ){
  16. echo $key."\t=>\t".$value."\n";
  17. }
  18.  
  19.  
Advertisement
Add Comment
Please, Sign In to add comment