Php traverses the array $ arr. what is the structure of the $ arr array below? how can I output the result of traversal? 123

Source: Internet
Author: User
Php traverses the array $ arr. what is the structure of the $ arr array below? how can I output the result of traversing the output: 123 using print_r ($ arr );
Output: Array ([0] => 1, 3, 2)
Use var_dump ($ arr );
Output: array (1) {[0] => string (5) "1, 3, 2 "}
For loop output to obtain
For ($ I = 0; $ I <sizeof ($ arr); $ I ++ ){
Echo $ arr [$ I];
}
Output: 1, 2, 3
// The comma actually traverses
What is the structure of this number? how can I remove the comma when traversing this for loop,
Only output the following structure:
1
2
3


Reply to discussion (solution)

$ Arr is an array $ arr = array ('1, 2, 3 ')
You CAN $ arr = explode (',', array ('1, 2, 3 '));
For loop again

Well, yes, thanks.

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.