How to Store Multiple Elements per Key in an Array?

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

आज इस आर्टिकल में हम आपको How to Store Multiple Elements per Key in an Array? के बारे में बताएंगे।

Problem:- How to Store MultipleElements per Key in an Array? You want to associate multiple elements with a single Key.

इसे भी पढ़े – बिना Root किये Android App के Icon और नाम कैसे Change करे?

Solution – Store Multiple Elements per Key in an Array

class="prettyprint lang-php" data-start-line="1" data-visibility="visible" data-highlight="" data-caption=""><?php
$fruits = array('red'=>array('strawberry', 'apple'), 'yellow'=> array('banana'));
print_r($fruits);
?>

ore Multiple Elements per Key in an Array</h2&gt; <pre class=”prettyprint lang-php” data-start-line=”1″ data-visibility=”visible” data-highlight=”” data-caption=””><?php $fruits = array(‘red’=>array(‘strawberry’, ‘apple’), ‘yellow’=&gt; array(‘banana’)); print_r($fruits); ?>

How it Works?

We can do it with multi dimensional array system also we can use 2 or 4 dimensional array system.

Problem:- How to Store MultipleElements per Key in an Array? You want to associate multiple elements with a single Key.

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

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

Final Words

  • आज इस आर्टिकल में हमने आपको Howto Store MultipleElements per Key in an Array? के बारे में बताया।
  • अगर आपको इससे जुडी कोई अन्य जानकारी चाहए है तो निचे कमेन्ट बॉक्स में कमेन्ट कर के पूछ सकते है।

इसे भी पढ़े – How to Start an Array with Index 1 in PHP?

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

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 *