PHP readline() 함수 실습 방법? command 모드에서 값 입력받는 방법?

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!
PHP readline() 함수 실습 방법? command 모드에서 값 입력받는 방법?

QA

PHP readline() 함수 실습 방법? command 모드에서 값 입력받는 방법?

본문


<?php
function classify_board($length, $width, $material) {
    if ($length > 8 && $width > 8) {
        if ($material == 'wood') {
            return 'longboard';
        } elseif ($material == 'plastic') {
            return 'cruiser';
        }
    } elseif ($length <= 8 && $width <= 8) {
        if ($material == 'wood') {
            return 'skateboard';
        } elseif ($material == 'plastic') {
            return 'mini-cruiser';
        }
    } else {
        return 'unknown';
    }
}
$board_length = (int) readline("Enter the length of the board in inches: ");
$board_width = (int) readline("Enter the width of the board in inches: ");
$board_material = readline("Enter the material of the board (wood or plastic): ");
$board_category = classify_board($board_length, $board_width, $board_material);
echo "The board is a: " . $board_category . "\n";

 

chatGPT가 위와 같은 코드를 짜줬는데, 위 예제를 어떻게 실습해야할지 모르겠어요,

command 모드에서 값을 입력받는 것 같은데....

이 질문에 댓글 쓰기 :

답변을 작성하시기 전에 로그인 해주세요.
전체 160
QA 내용 검색
filter #php ×

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT