Associative Arrays

Are more intuitive than index arrays. Similar to classes. In place of keys you can use names instead of numbers. How to create On one line: $pop= array("brazil"=>"110", "portugal"=>"10"); One by one: $pop['brazil']...

Two ways to iterate over php indexed array

$cars = array("a", "b", "c"); $arrlength = count($cars); for($x = 0; $x < $arrlength; $x++) { echo $cars[$x]; echo "<br>"; } echo "<hr>"; foreach($cars as $x) { echo $x; echo "<br>";...

How to Remove HTML tags and all special characters

<?php // $str = "<h1>Africa ≠ America ÆØÅ! &+ </h1>"; // Remove HTML tags and all characters with ASCII value > 127 $str2 = filter_var($str, FILTER_SANITIZE_STRING,FILTER_FLAG_STRIP_HIGH); echo $str2; // result: Africa America !...