로그인

검색

사용자로부터 무언가 여러개의 값을 입력받아 연산이나 출력등 다양하게 사용할 경우가 있습니다. 이때 implode()와 맞대응 하는 explode()를 사용할 수 있습니다.

 

$strings = "A,B,C,D";
$strings_array = explode(',', $strings);
print_r($strings_array);

 

사용자로 부터 , 로 구분하여 입력하여 받은 값을 $strings 변수에 담아 이를 구분된 값을 활용하기 위해서 배열로 변환을 해서 이용할 수 있는데 이때 explode() 를 사용해서 배열로 변환할 수 있습니다.

 

Array ( [0] => A [1] => B [2] => C [3] => D )

 

이렇게 , 로 구분해서 각각의 값을 원소의 값으로 가진 배열로 변환이 된 것입니다.

 

Who's 꿀팁관리소장

profile
라이믹스로 커뮤니티 사이트를 운영하는 비개발자 운영자 입니다.
파트너쉽 맺으실 사이트 운영자분 환영합니다.
2 추천

php 기초지식(24)

php를 학습할 수 있습니다.

  1. read more
  2. read more
  3. php 객체 확장

    Date2021.09.20 Views161 Votes2
    Read More
  4. php 객체 생성자 __construct 메서드

    Date2021.09.17 Views405 Votes2
    Read More
  5. Read More
  6. php 객체 지향의 이해 4

    Date2021.09.12 Views215 Votes2
    Read More
  7. php isset()

    Date2021.09.11 Views109 Votes2
    Read More
  8. php 변수의 영역 전역변수와 지역변수

    Date2021.08.29 Views1577 Votes2
    Read More
  9. php 함수의 반환값

    Date2021.08.28 Views140 Votes2
    Read More
  10. php 함수의 기초

    Date2021.08.25 Views161 Votes2
    Read More
  11. php 다차원 배열

    Date2021.08.14 Views416 Votes2
    Read More
  12. Read More
  13. Read More
  14. php 배열의 원소 제거 unset()

    Date2021.08.08 Views292 Votes2
    Read More
  15. Read More
  16. Read More
  17. php 배열(array)

    Date2021.07.31 Views152 Votes2
    Read More
  18. php 반복문 for, while

    Date2021.07.28 Views385 Votes2
    Read More
  19. php 증감 연산자 ++, -- 3

    Date2021.07.27 Views200 Votes2
    Read More
  20. 활용이 가장 많은 중요한 if 조건문 3

    Date2021.07.26 Views188 Votes2
    Read More
  21. php 이스케이프 \(역슬래쉬) 사용 1

    Date2021.07.24 Views639 Votes2
    Read More
  22. Read More
Prev 1 2 Next
/ 2