Thursday, 14 February 2013

Check your Array type in PHP


if you want to know your array is a numerical or associative for some specific task but PHP don't have any in built functions.i write down one function which return output in Boolean if Array is a Associative it will return True else it will return False..
 

//function
 
 function is_assoc($array) {
 
  return (bool)count(array_filter(array_keys($array), 'is_string'));
 
}


 //test some array
 
var_dump(is_assoc(array('a', 'b', 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("0" => 'a', "1" => 'b', "2" => 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("1" => 'a', "0" => 'b', "2" => 'c')));  // false(numeric key)
 
var_dump(is_assoc(array("a" => 'a', "b" => 'b', "c" => 'c')));  // true(associative key)
 
 
 
 
 

116 comments:

  1. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site. php training in chennai

    ReplyDelete
  2. Thanks a lot very much for the high your blog post quality and results-oriented help. I won’t think twice to endorse to anybody who wants and needs support about this area. hadoop training in bangalore

    ReplyDelete
  3. Lots of game slots only here play casino games convenient Do not wait! Win right here and now.

    ReplyDelete

  4. Thanks Admin For sharing this massive info with us. it seems you have put more effort to write this blog , I gained more knowledge from your blog. Keep Doing..
    Regards,
    RPA Training in Chennai
    RPA Classes in Chennai
    CCNA Training in Chennai
    DevOps Training in Chennai
    SEO Training in Chennai
    RPA Training in OMR
    RPA Training in Velachery
    RPA Training in Tambaram

    ReplyDelete
  5. Hello, I read your blog occasionally, and I own a similar one, and I was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can advise? I get so much lately it’s driving me insane, so any assistance is very much appreciated.
    Data science Course Training in Chennai |Best Data Science Training Institute in Chennai
    RPA Course Training in Chennai |Best RPA Training Institute in Chennai
    AWS Course Training in Chennai |Best AWS Training Institute in Chennai

    ReplyDelete
  6. Your info is really amazing with impressive content..Excellent blog with informative concept. Really I feel happy to see this useful blog, Thanks for sharing such a nice blog..
    If you are looking for any Data science Related information please visit our website Data Science Course In Bangalore page!

    ReplyDelete
  7. Informative post indeed, I’ve being in and out reading posts regularly and I see alot of engaging people sharing things and majority of the shared information is very valuable and so, here’s my fine read.
    click here button instagram story
    click here clipart
    click here css
    click here call to action
    click here css animation

    ReplyDelete
  8. Thanks for sharing useful information. I learned something new from your bog. Its very interesting and informative. keep updating. If you are looking for any Python programming related information, please visit our website python training institute in BTM layout

    ReplyDelete
  9. Thanks a lot for sharing
    Having good health is what most people out there wants but can not achieve. some people takes buy ibogaine online AND buy weed online to get it.

    ReplyDelete
  10. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision...
    Java Project Center in Chennai | Java Project Center in Velachery | Java Projects in Velachery

    ReplyDelete
  11. Very interesting blog which helps me to get the in depth knowledge about the technology, Thanks for sharing such a nice blog...
    IOT Project Center in Chennai | IOT Project Center in Velachery | IOT Projects for BE in Pallikaranai | IOT Projects for ME in Taramani

    ReplyDelete
  12. medical care is what many people lack in the interior areas of the world. people face a lot of health issues everyday without solution. buy magic mushroom, Buy weed online, Buy heroin online

    ReplyDelete
  13. I have been reading for the past two days about your blogs and topics, still on fetching! Wondering about your words on each line was massively effective. share more
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  14. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this. nice post
    Ai & Artificial Intelligence Course in Chennai
    PHP Training in Chennai
    Ethical Hacking Course in Chennai Blue Prism Training in Chennai
    UiPath Training in Chennai

    ReplyDelete
  15. Pretty article! I found some useful information in your blog, it was awesome to read, thanks for sharing this great content to my vision.. really nice to read guys.
    AngularJS training in chennai | AngularJS training in anna nagar | AngularJS training in omr | AngularJS training in porur | AngularJS training in tambaram | AngularJS training in velachery

    ReplyDelete
  16. Excellent post... Thank you for sharing such a informative and information blog with us.keep updating such a wonderful post..
    MicorSoft Azure Training Institute in Chennai | Azure Training Center in Chennai | Azure Certification Training in velachery | Online Azure training in Velachery

    ReplyDelete
  17. Your blog is really amazing, its very informative article and useful for everyone.. Thanks for
    sharing such a nice post..
    Java Training Institute in Chennai | Java Training Center in Velachery | Java Courses in Velachery | Java online Training in Velachery

    ReplyDelete
  18. I am glad to post a worthy article about the German Language Course and IELTS Coaching from KCR consultants, this may change your career growth and language skill.
    KCR CONSULTANTS
    KCR CONSULTANTS

    ReplyDelete
  19. 24K Monkey Classic Incense 10g
    AK-47 – X10 / PREMIUM
    Bizarro Incense
    Buy Black Mamba Incense Online
    Buy WTF Herbal Incense
    Cloud9 Mad Hatter Incense
    Crazy Monkey Incense
    k2 spray on paper
    k2 paper sheets
    Klimax Potpourri 15xxx Coconut(10g)
    Crazy Monkey Incense
    Cloud9 Mad Hatter Incense
    Buy Purple Diesel Incense Online
    Buy Pure Fire Herbal Incense Online
    Buy Kisha Cole Incense (11g) online
    Buy KUSH HERBAL INCENSE online
    Buy Mind Trip Incense Online
    Buy Platinum XXX Herbal Incense online
    buy Orange Platinum Caution 10G
    Buy OMG HERBAL POTPOURRI 10G online

    ReplyDelete
  20. Thanks for sharing What an interesting site you have i really take a good look buy cocaine online and you can also take a good look at our blog too for more information buy crack cocaine online we also recommend you to take a good look at this site too they have good content buy mdma crystals online more of the site still want you to take a closer look too as they have really good content buy crystal meth online thanks for using your time to check on the link .order cocaine online

    ReplyDelete
  21. https://k2incenseonlineheadshop.com/
    k2incenseonlineheadshop
    info@k2incenseonlineheadshop.com
    Buy liquid incense cheap
    Buy liquid incense cheap For Sale At The Best Incense Online Shop
    K2 Spice Spray | Liquid K2 | Liquid Spice | K2 Spray for sale
    https://k2herbalblendshop.com/

    ReplyDelete
  22. https://bestmjstrainsonline.com/

    Buy Liquid Incense Cheap
    Buy K2 E-Liquid online
    Cheap Herbal incense

    Buy K2 Infused paper spray online, order K2 Spray online +1 (925) 526-5453

    https://bestmjstrainsonline.com/product/5-co2-cannabis-oil-cartridges/



    ReplyDelete
  23. Nice post... Really you are done a wonderful job. Thanks for sharing such wonderful information with us. Please keep on updating...
    Summer Courses Training in Velachery|
    Software Testing Training in Velachery |
    ISTQB Training in Velachery |
    Selenium Automation Training in Velachery |
    JAVA Training in Velachery |

    ReplyDelete
  24. AllTechz Solution is the Best BBA Project Center in Chennai. AllTechz Solution offers BBA projects in Finance, Marketing, HR and Operations for the BBA college students. All the management who are studying final year projects contain Synopsis, Objective, Nature of Company, Project Proposal & Introduction, Methodology & Data Points, Interpretation, Analysis, Recommendation & Conclusion and References & Bibliography. Recommended as Best BBA project Center in Chennai by the various management college students in Chennai. ATS provide high class and end to end management training and guidance in Final year projects for BBA in Chennai at Velachery. Please call AllTechz Solution to 7810898997 or give a call or fill up our online enquiry form to get more details about BBA Projects in Chennai for current year.

    ReplyDelete
  25. Very Excellent and awesome Blog you are posted each and every Points are unique. Thanks for sharing such a nice Blog, keep on updating more
    Summer Courses Training in Tharamani|
    JAVA Training in Tharamani |
    Web Designing Training Center in Tharamani |
    Software Testing Training in Tharamani |
    Selenium Training in Tharamani |

    ReplyDelete
  26. The information you have here is really useful . It is truly supportive for us and I have accumulated some essential data from this blog.
    Web Designing Training Center in Chennai |
    Tally Training in Chennai |
    Selenium Training in Chennai |
    Summer Courses Training in Chennai|
    JAVA Training in Chennai |

    ReplyDelete
  27. Excellent Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Python Training in Chennai|
    Web Designing Training Center in Chennai |
    Tally Training in Chennai |
    AWS Training in Chennai|
    Hardware and Networking Training in Chennai |

    ReplyDelete
  28. Really you are done a wonderful job. I learn more knowledge while reading this blog Please keep on updating More ...
    PMP Exams in Velachery|
    PMP Exams in Chennai|
    PMP Exams in Tharamani|
    PMP Exams in Perungudi|
    PMP Exams in Thambaram

    ReplyDelete
  29. Impressive blog with Usefull information. Really very useful article for us thanks for sharing such a wonderful blog...
    ITIL Exams in Chennai|
    ITIL Exams in Velachery|
    ITIL Exams in Tharamani|
    ITIL Exams in Perungudi|
    ITIL Exams in Thambaram

    ReplyDelete
  30. Nice post.. Its really an amazing with informative information and useful for everyone. Thanks for sharing your wonderful article..

    AWS Certification in Chennai | AWS Exam Center in Chennai | AWS Exams in Velacheri | AWS Online Exams in Velachery | Online Certification in Chennai

    ReplyDelete
  31. “Nice post!” Keep up the Amazing Good Work. Really your post was very interesting to read. Waiting for your upcoming update. Good Luck….



    AWS Training Institute in Velachery |
    AWS Training Institute in Chennai |
    AWS Training Institute in Tambaram |
    AWS Training Institute in Taramani|
    AWS Training Institute in Medavakkam

    ReplyDelete
  32. Nice blog. You put Good stuff. All the topics were explained briefly. So easily understand for me. I am waiting for your next awesome blog. Thanks for sharing.


    Python Training Institute in Velachery |
    Python Training Institute in Chennai |
    Python Training Institute in Tambaram |
    Python Training Institute in Taramani|
    Python Training Institute in Medavakkam

    ReplyDelete
  33. Amazing blog with informative information... Thanks a lot for sharing such an wonderful post with us...
    PCB Design Training in Chennai | PCB Training Institute in Velachery

    ReplyDelete
  34. Really amazing information you have shared with us. Thanks for sharing your wonderful post..
    ISTQB Certification in Chennai | ISTQB Exams in Velachery

    ReplyDelete
  35. Really it was an awesome article...very interesting to read. You have provided an nice article....Thanks for sharing..
    MBA Project Center in Chennai | MBA Projects in Velachery

    ReplyDelete
  36. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    PMP Certification in Chennai | PMP Exam Center in Velachery

    ReplyDelete
  37. Very informative blog. Thanks for sharing such a excellent blog. It is very useful for everyone. keep sharing
    GMAT Test Center in Chennai | GMAT Test Center in Velachery

    ReplyDelete
  38. Thank you so much for such valuable information sharing. It’s highly appreciated
    Agile Scrum Master Training in Chennai | Agile Scrum Master Training in Velachery

    ReplyDelete
  39. Wow!!!.. Superb blog with informative information's. Thanks for posting..
    TOEFL Test Center in Chennai | TOEFL Test Center in Velachery

    ReplyDelete
  40. Awesome post. Really you are shared very informative concept... Thank you for sharing. Keep on updating...
    GMAT Test Center in Chennai | GMAT Test Center in Velachery

    ReplyDelete
  41. Your article is really an informative content.. Its very useful to everyone.. keep updating
    Agile Scrum Master Training in Chennai | Agile Scrum Master Training in velachery

    ReplyDelete
  42. Thank you so much for sharing your nice post with us.. keep updating..
    GMAT Test Center in Chennai | GMAT Test Center in Velachery

    ReplyDelete
  43. Nice blog. Thank you for sharing. The information you shared is very effective article..
    Final Year Project Center in Chennai | Final Year Projects in Velachery

    ReplyDelete
  44. Really an amazing blog with useful information.. keep updating..
    GMAT Test Center in Chennai | GMAT Test Center in velachery

    ReplyDelete
  45. Really an amazing blog with useful information you have shared. Thanks for sharing such an nice article..
    Final Year Project Center in Chennai | Final Year Projects in Velachery

    ReplyDelete
  46. I am really happy to read your blog. Your article is awesome with impressive content. Keep updating..
    IELTS Test Center in Chennai | IELTS Test Center in Velachery

    ReplyDelete

  47. to the medical condition of most patients. many people suffering from cancer, chronic pain, anxiety and man more have overcome their illment with cannabis. you can order weed from our store

    ReplyDelete



  48. marijuana has been a stepping stone to the medical condition of most patients.
    many people https://credibleweeddelivery.com/product/super-lemon-haze/ suffering from cancer, chronic pain, anxiety, and many more have overcome their aillment with cannabis.
    you can order weed from our store.medical condition

    ReplyDelete
  49. Dispensary care is what many people lack in the interior areas of the world. Weed, can help you recover shortly. marijuana. people face a lot of health issues everyday without solution. Weed However, marijuana has always been a perfect remedy for ill health. Nevertheless, cocaine may also help.

    ReplyDelete
  50. Much obliged for sharing this brilliant substance. its extremely fascinating. Numerous web journals I see these days don't actually give whatever pulls in others however the manner in which you have plainly clarified everything it's truly awesome. There are loads of posts But your method of Writing is so Good and Knowledgeable. continue to post such helpful data and view my site too...
    Fold n fly | Classic dart paper airplane | how to make a paper airplane that flies far and straight step by step | windfin | stable paper airplane | nakamura paper airplane | paper airplane templates for distance

    ReplyDelete
  51. Its very interesting blog and well explained.... I am looking forward to reading more of your posts. Thanks for sharing this amazing post with us.. Best place to complete your projects final year matlab projects chennai on time with guaranteed output ..

    ReplyDelete
  52. VRay 6.00.05 Crack is used by an expert for making and for designers and creative designers. This software is an awesome tool for designers. https://crackdj.com/vray-crack-for-sketchup-with-key-2023/

    ReplyDelete
  53. With these messages, tell her you miss her so very much, and that you want her so badly. Missing You Text Messages for Wife. I Miss You My Wife

    ReplyDelete
  54. Sylenth1 Crack System from here and take advantage of premium software for free. You simply need a working digital keying workstation for. Sylenth1 3.073 Crack

    ReplyDelete