Note that there are some explanatory texts on larger screens.

plurals
  1. POGet record from array in single line
    primarykey
    data
    text
    <p>I have an array e.g</p> <pre><code>Array ( [0] =&gt; stdClass Object ( [id] =&gt; 71 [sku] =&gt; cp1038 [name] =&gt; Dual tone stripped pillow [slug] =&gt; dual-tone-stripped-pillow-222 [route_id] =&gt; 152 [description] =&gt; Address Home, a brand new Luxe Lifestyle boutique, Everything from plus bed and table Linen to cushions, curtain and upholstery fabric in silk, cotton, satin, velvet, jacquard and polyester, embellished with foil printing, contemporary embroidery, crystals, quilting and other types of texturing, includin so much I JUST knew there was something really exciting coming up. And how right I was! [excerpt] =&gt; Dual tone stripped pillow 2 exec [price] =&gt; 1000.00 [saleprice] =&gt; 0.00 [free_shipping] =&gt; 0 [shippable] =&gt; 1 [taxable] =&gt; 1 [fixed_quantity] =&gt; 0 [weight] =&gt; 10 [track_stock] =&gt; 1 [quantity] =&gt; -93 [related_products] =&gt; [images] =&gt; {"0c2ef0ca18f628641cd55fdfbcbfb4ad":{"filename":"0c2ef0ca18f628641cd55fdfbcbfb4ad.jpg","alt":"","caption":"","primary":true},"ac632a9f43216dce4b643b6164bb5891":{"filename":"ac632a9f43216dce4b643b6164bb5891.jpg","alt":"","caption":""},"4623ecf1d9448868fb5ec868ba2292f8":{"filename":"4623ecf1d9448868fb5ec868ba2292f8.jpg","alt":"","caption":""},"1df39f0e7e6d95c7a6f429ed105cd045":{"filename":"1df39f0e7e6d95c7a6f429ed105cd045.jpg","alt":"","caption":""}} ) [1] =&gt; stdClass Object ( [id] =&gt; 73 [sku] =&gt; cp1040 [name] =&gt; Dual tone stripped pillow1 [slug] =&gt; dual-tone-stripped-pillow-224 [route_id] =&gt; 154 [description] =&gt; Dual tone stripped pillow 2 desc [excerpt] =&gt; Dual tone stripped pillow 2 exec [price] =&gt; 1000.00 [saleprice] =&gt; 0.00 [free_shipping] =&gt; 0 [shippable] =&gt; 1 [taxable] =&gt; 1 [fixed_quantity] =&gt; 0 [weight] =&gt; 10 [track_stock] =&gt; 1 [quantity] =&gt; -8 [related_products] =&gt; [images] =&gt; {"bf2b5529299fa57b586cb393f374b69a":{"filename":"bf2b5529299fa57b586cb393f374b69a.jpg","alt":"","caption":""},"97c99c58f7d5e32b63a4f9f0b35b3167":{"filename":"97c99c58f7d5e32b63a4f9f0b35b3167.jpg","alt":"","caption":""},"e1b38b5aabc82e26c4920e0c36d28ceb":{"filename":"e1b38b5aabc82e26c4920e0c36d28ceb.jpg","alt":"","caption":"","primary":true},"fd19de4ef12d84dd5e0e6e9fca67f1c1":{"filename":"fd19de4ef12d84dd5e0e6e9fca67f1c1.jpg","alt":"","caption":""}} ) [2] =&gt; stdClass Object ( [id] =&gt; 37 [sku] =&gt; cp202 [name] =&gt; Dual tone stripped pillow [slug] =&gt; dual-tone-stripped-pillow21 [route_id] =&gt; 96 [description] =&gt; Address Home, a brand new Luxe Lifestyle boutique, Everything from plus bed and table Linen to cushions, curtain and upholstery fabric in silk, cotton, satin, velvet, jacquard and polyester, embellished with foil printing, contemporary embroidery, crystals, quilting and other types of texturing, including tiny metallic pieces. [excerpt] =&gt; silk two tone pillow with diagonal stripes [price] =&gt; 1500.00 [saleprice] =&gt; 0.00 [free_shipping] =&gt; 0 [shippable] =&gt; 1 [taxable] =&gt; 1 [fixed_quantity] =&gt; 0 [weight] =&gt; 10 [track_stock] =&gt; 1 [quantity] =&gt; -43 [related_products] =&gt; [images] =&gt; {"0687014a0caff0874107272a5296e465":{"filename":"0687014a0caff0874107272a5296e465.jpg","alt":"","caption":""},"c0a6037628b6f19d6cb8c244cd79fb10":{"filename":"c0a6037628b6f19d6cb8c244cd79fb10.jpg","alt":"","caption":"","primary":true},"6e7dc08cedd9b54ca44bf7fd832f20c7":{"filename":"6e7dc08cedd9b54ca44bf7fd832f20c7.jpg","alt":"","caption":""},"4a74346e35a4b986e03ab69044cad44b":{"filename":"4a74346e35a4b986e03ab69044cad44b.jpg","alt":"","caption":""}} ) ) </code></pre> <p>And I have id like 71, 73 etc. So I want to fetch the record from array whose id is e.g 73.</p> <p>How can I get it.</p> <p>I know this is not so tough but I am not able to get it in a single line.I can get the record running foreach loop of array and match my id but if I have thousands of records in an array then it would be wrong way thats why I am asking any direct way to get record.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload