How to Start an Array with Index 1 in PHP?

How to Expose and Route to a Resource?
How to Expose and Route to a Resource?

आज इस आर्टिकल में हम आपको How to Start an Array with Index 1 in PHP? के बारे में बताएंगे।

Problem:- How toStart an Array with Index 1 in PHP? You want to assign multiple elements to an array in one steps but you don’t want the first index to be 0;

Solution – Start an Array with Index 1 in PHP?

<?php
$color =array(1=>'red', 'green', 'blue');
print_r($color);
?>

How it Works?

Super Easy, If we define a index number while initializing an array next index number change according the previous number.

Problem:- How toStart an Array with Index 1 in PHP? You want to assign multiple elements to an array in one steps but you don’t want the first index to be 0;

इसे भी पढ़े –CSS Color Name, RGB & Hex Code Tutorials in Hindi – Part 3

इसे भी पढ़े – Blogger पर नई Post कैसे लिखे?

Final Words

  • आज इस आर्टिकल में हमने आपको How toStart an Array with Index 1 in PHP? के बारे में बताया।
  • अगर आपको इससे जुडी कोई अन्य जानकारी चाहए है तो निचे कमेन्ट बॉक्स में कमेन्ट कर के पूछ सकते है।

इसे भी पढ़े – Find the Second Largest Number in an Array Using PHP?

इसे भी पढ़े – Creating Dynamic Variable Name – $$ Uses Using PHP

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *