How should I write the PHP application logic?

Source: Internet
Author: User
I have a function that can return the current devices. the devices are as follows {code ...} then I have a function to determine which devices are currently available. for example, the currently available devices include {code ...} the requirement is that when the current device is determined to be a mobile device, if the mobile device does not exist, then... I have a function that returns the current devices. the devices are as follows:

$page_style_default = array('pc','mobile','weixin','pad','pc_old','mobile_old','pc_soft','mobile_soft');

Then I have a function to determine which devices are currently available.

For example, the currently available devices have

array('pc','pad');

The requirement is that, when the current device is determined to be mobile, if the mobile device does not exist, the system determines that the pad exists and then calls the pad

If it is determined that the current device is mobile_old and only (pc and pad) is available, first determine whether there is mobile_old and then determine whether there is mobile and then whether there is a pad if there is no pad, final output pc

I don't know how to write if statements?

The hierarchical relationship is as follows:

Https://www.processon.com/view/577c5bafe4b04bc7eeac5bae

Reply content:

I have a function that returns the current devices. the devices are as follows:

$page_style_default = array('pc','mobile','weixin','pad','pc_old','mobile_old','pc_soft','mobile_soft');

Then I have a function to determine which devices are currently available.

For example, the currently available devices have

array('pc','pad');

The requirement is that, when the current device is determined to be mobile, if the mobile device does not exist, the system determines that the pad exists and then calls the pad

If it is determined that the current device is mobile_old and only (pc and pad) is available, first determine whether there is mobile_old and then determine whether there is mobile and then whether there is a pad if there is no pad, final output pc

I don't know how to write if statements?

The hierarchical relationship is as follows:

Https://www.processon.com/view/577c5bafe4b04bc7eeac5bae

Resolved,
Store an array of PCs and mobile devices separately, use in_array () to determine whether the current device exists, whether the current device belongs to the pc or mobile device, and then output the data in a unified manner.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.