답변 2개
채택된 답변
+20 포인트
11년 전
</p><p><?php</p><p># 특정 회원의 특정 정보(<span style="font-size: 10pt; line-height: 1.5;">mb_id, mb_name, mb_4</span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;">)를 호출</span></p><p>$mb = get_member('아이디', 'mb_id, mb_name, mb_4');</p><p>/*</p><p><span style="font-size: 10pt; line-height: 1.5;">$mb의 내용</span><span style="font-size: 10pt; line-height: 1.5;"></span></p><p>array(</p><p> 'mb_id' => '아이디',</p><p> 'mb_name' => '아무개',</p><p> 'mb_4' => '<span style="font-family: gulim, helvetica; line-height: 23.5440006256104px; font-size: 10pt; background-color: rgb(255, 255, 255);">1980-11-14</span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;">'</span></p><p><span style="font-size: 10pt; line-height: 1.5;">);</span></p><p>*/</p><p># 만 나이</p><div>$age_ = ( date('Y') - date('Y', strtotime($mb['mb_4'])) );</div><div>
</div><div># 만 나이 +1</div><div><span style="font-size: 10pt; line-height: 1.5;">$age = </span><span style="font-size: 10pt; line-height: 1.5;">$age_</span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;"> +1;</span></div><div><span style="font-size: 10pt; line-height: 1.5;">
</span></div><div><span style="font-size: 10pt; line-height: 1.5;"># 출력</span></div><div><p>echo <span style="font-size: 10pt; line-height: 1.5;">$mb['mb_name'] .'(' .</span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;">$mb['mb_id'] </span><span style="font-size: 10pt; line-height: 1.5;">.') 님의 나이는 '. $age .'(만'. </span><span style="font-size: 10pt; line-height: 1.5;">$age_ </span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;">.')세 입니다.';</span></p><p>
간단하게 하면
</p><p><?php</p><p>echo <span style="font-size: 10pt; line-height: 1.5;"> </span><span style="font-size: 10pt; line-height: 1.5;">( date('Y') - date('Y', strtotime('</span><span style="font-size: 10pt; font-family: gulim, helvetica; line-height: 23.5440006256104px; background-color: rgb(255, 255, 255);">1980-11-14</span><span style="font-size: 10pt; line-height: 1.5;"></span><span style="font-size: 10pt; line-height: 1.5;">')) ) +1;</span></p><p><span style="font-size: 10pt; line-height: 1.5;">
입니다.
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
수아주환
11년 전
감사합니다..^^
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인