if statement - If inside if in php -


मेरे पास ऐसा कोड है

  foreach ($ all_meta_for_user $ key = & gt; $ val) {if (array_key_exists ('invoice_company_name', $ val) & amp; amp; और & amp; amp; array_key_exists ('invoice_street', $ val) & amp; amp; & amp; amp; array_key_exists ('invoice_street_number', $ val) & amp; amp; & amp; amp; amp; & amp; आरआरआई _key_exists ('invoice_post_code' $ val) & amp; amp; & amp; amp; array_key_exists ('invoicearg', $ val) & amp; amp; & amp; amp; amp; & amp; amp; amp; & amp; amp; amp; & amp; amp; amp; & amp; amp; _key_exists ('invoice_country', $ val) & amp; amp; & amp; amp; amp; & amp; amp; amp; & amp; amp; _key_exists ('invoice_nip', $ val)): & gt;   

मुझे क्या करना है: & amp; amp; Array_key_exists ('invoice_nip', $ val) भाग 'if'ed' होना चाहिए

मेरे पास दो प्रकार के खाते - व्यक्तिगत और कंपनी,

इसलिए जब कोई व्यक्ति व्यक्तिगत उपयोगकर्ता होता है, तो निप के साथ अंतिम विवरण आवश्यक नहीं है।

जब कोई कंपनी का खाता होता है, इसकी ज़रूरत होती है

कोई विचार? :))

धन्यवाद!

बस एक काम यहाँ के रूप में करें:

अपनी अंतिम स्थिति को

  और amp; amp; ($ accType == 'individual' || array_key_exists ('इनवॉइस_एनिप', $ वेल))   

इस तरह पिछली हालत की जांच की जाएगी यदि आपका $ accType व्यक्तिगत नहीं है

  $ accType = 'कंपनी'; {If (array_key_exists ( 'invoice_company_name', $ वैल) & amp; & amp;; foreach ($ वैल $ कुंजी = & gt के रूप में $ all_meta_for_user) array_key_exists ( 'invoice_street', $ वैल) & amp; & amp; array_key_exists ( 'invoice_street_number', $ वैल ) & amp; & amp; array_key_exists ( 'invoice_post_code', $ वैल) & amp; & amp; array_key_exists ( 'invoice_city', $ वैल) & amp; & amp; array_key_exists ( 'invoice_country', $ वैल) & amp; & amp; ($ accType == ' व्यक्तिगत '|| array_key_exists (' invoice_nip ', $ val))):? & Gt;   

मुझे लगता है कि आप यही पूछ रहे हैं?

हैप्पी कोडिंग!

Comments

Popular posts from this blog

jsp - No mapping found for HTTP request with URI with annotation config Spring MVC and Jetty -

c# - Split String between 2 substrings without removing delimiters -

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -