#54. PHP Array_Fill & Array_Fill_Keys

How to work PHP Array_Fill_Keys?


Run Code:


<?php
adding Keys, Values etc
$cars = array("MG","Civic","Alto","Mehran","Carola");

$newArr = array_fill_keys($cars, "Hello");


echo "<pre>";
print_r($newArr);
echo "</pre>";


How to work PHP Array_Fill?



Run Code:


<?php


//----array_fill Can't need Array Function
$newArr = array_fill(2,6,"Hello");
echo "<pre>";
print_r($newArr);
echo "</pre>";

Comments

Popular posts from this blog

#30. PHP Recursive Function