PHP function splitting

Source: Internet
Author: User
PHP function split $ str = "0791280266601-5011 ";
Print_r (explode ("-", $ str ));

Display effect: Array ([0] => 0791280266601 [1] => 5011 );


========================================================== =
First, how do I get the "0?
2 [1] how to get it? It's split now, but I don't know how to get it?
Prawn for advice


Reply to discussion (solution)

$ T = explode ("-", $ str );
Echo $ t [0];
Echo $ t [1];

$ T = explode ("-", $ str );
Echo $ t [0];
Echo $ t [1];

------------------------------
You just removed the horizontal bar. I want to go to the front of the horizontal bar and the numbers below it.


Your output: 07912802666015011 is wrong

What I want is: 0791280266601
The following result: 5011

Can an adult reply to the moderator meet what you want?

Can an adult reply to the moderator meet what you want?
--------------------------------------
What I do now is:
$ Str = "0791280266601-5011 ";
Print_r (explode ("-", $ str ));

Display effect: Array ([0] => 0791280266601 [1] => 5011 );

I just want to get the value of Array ([0] => 0791280266601 [1] => 5011); [0] in it

$ Str = "0791280266601-5011 ";
$ T = explode ("-", $ str );
Echo $ t [0]."
";
Echo $ t [1];

Output
0791280266601
5011

$ Str = "0791280266601-5011 ";
$ T = explode ("-", $ str );
Echo $ t [0]."
";
Echo $ t [1];

Output
0791280266601
5011

Thank you. I'm stupid. thank you.

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.