PHP function splitting

Source: Internet
Author: User
$str = "0791280266601-5011";
Print_r (Explode ("-", $str));

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


=========================================
First, how do I get the "0"?
How do you get the second "1"? Now it's torn apart, 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're just going to get rid of the bars, and I want to go to the front of the bar and the numbers behind it.


The effect of your output: 07912802666015011 is wrong.

The effect I want is: 0791280266601
Back to: 5011

Moderator Adult's reply can not achieve what you want, there is a problem of Satan?

Moderator Adult's reply can not achieve what you want, there is a problem of Satan?
--------------------------------------
What I do now is:
$str = "0791280266601-5011";
Print_r (Explode ("-", $str));

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

I just want to get an array ([0] = 0791280266601 [1] = 5011); the [0] value inside

$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 am more 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.