ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • substr
    APM(ApachePhpMysql) 2024. 10. 10. 18:20
    $string = "Hello, World!";
    $result = substr($string, 7, 5); // "World"
    echo $result; // 출력: World
    
    $string = "Hello, World!";
    $result = substr($string, -6); // "World!"
    echo $result; // 출력: World!

    문자열의 일부분 추출

    substr(string $string, int $start, int $length = null)
    • $string: 추출할 원본 문자열입니다.
    • $start: 추출을 시작할 위치입니다. 문자열의 첫 번째 문자는 0부터 시작합니다. 음수를 지정하면 문자열의 끝에서부터 카운트합니다.
    • $length: 선택적 매개변수로, 추출할 문자열의 길이입니다. 이 매개변수를 지정하지 않으면 $start부터 문자열 끝까지 추출

    'APM(ApachePhpMysql)' 카테고리의 다른 글

    split  (0) 2024.10.10
    JSON.parse  (0) 2024.10.10
    Json_Encode  (0) 2024.10.10
    foreach문  (0) 2024.10.10
    is not defined  (0) 2024.09.23
Designed by Tistory.