Help solve the problem related to the array! (For beginners .)

Source: Internet
Author: User
Help solve the array problem! (Cainiao...) that is to say, the current data of a variable $ p is 221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587 & nb to help solve the problem of! (Cainiao asked ..)
That is to say, the data of $ p is 221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587.
This is from echo...
How to define an array now... put the data one by one into the data...
$ S [0] = 221, $ s [1] = 567 ............


Please help me!

------ Solution --------------------
$ P = "221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587"
$ S = explode (',', $ p );
Print_r ($ s );


------ Solution --------------------
$ P = '2017, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587 ';
$ S = explode (',', $ p );
Print_r ($ s );

-------------------

---------- PHP debugging ----------
Array
(
[0] = & gt; 221
[1] => 567.
[2] => 568.
[3] = & gt; 569
[4] = & gt; 572
[5] = & gt; 573
[6] = & gt; 1408
[7] = & gt; 1723
[8] = & gt; 1724
[9] = & gt; 1725
[10] => 1726.
[11] => 1727.
[12] = & gt; 1728
[13] = & gt; 1729
[14] => 1730.
[15] = & gt; 1731
[16] = & gt; 1732
[17] => 1733.
[18] = & gt; 2586
[19] = & gt; 13587
)

Output completed (time consumed: 0 seconds)-normal termination
------ Solution --------------------
$ P = "221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587"

Print_r (split (",", $ p ));

This works too ..
------ Solution --------------------
$ P = "221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587 ";
$ S = explode (",", $ p );
-------------
Echo $ s; // output array
-------------
In this way, the data in $ p is saved to the array $ s: $ s [0] = 221; $ s [1] = 567 ......... $ [19] = 13587;

------ Solution --------------------
$ P = "221,567,568,569,572,573,140, 1723, 1724,1725, 1726,1727, 1728,1729, 1730,1731, 1732,1733, 2586,13587"
$ S = explode (',', $ p );
Print_r ($ s );
------ Solution --------------------
... Upstairs

Explode and the bird function. I'm still using split.
My daily php is disgusting. the same function has N functions.

By the way, we will ask you at 20:30:20 on January 9 ,.
How to output 2000-01-09
Is explode used to separate?
Is there a function similar to datevalue in asp?

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.