How does php extract key values containing different strings from the array and replace them cyclically to return a new array?

Source: Internet
Author: User
Php how to extract key values containing different strings from the array and cyclically replace returns the structure of a new array data table if $ a = array (nsk-aaayb, MP-00A00uk-000), output nsk-aaa0F, MP-00A00IO-000nsk-aaa0F, MP-00A00F0-000nsk-php how to extract key values containing different strings from the array and return a new array with a replacement loop
The data table structure is


If $ a = array (nsk-aaayb, MP-00A00uk-000), output

Nsk-aaa0F, MP-00A00IO-000

Nsk-aaa0F, MP-00A00F0-000

Nsk-aaa1F, MP-00A00SA-000

And so on ..

If $ a = nsk-aaayb, output

Nsk-aaa0F

Nsk-aaa0F

Nsk-aaa1F

And so on ..

Which of the following heroes can help you solve the problem? thank you first.
------ Solution --------------------


$query=mysql_query("select * from table");
 
while ($row = mysql_fetch_array($query)) {
    if(is_array($a)) {
        echo 'nsk-aaa'.$row['darfon'].',MP-00A00'.$row['chicony'].'-000';
    } else if(is_string($a)) {
        echo 'nsk-aaa'.$row['darfon'];
    }
}


That's what it means...

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.