"Deprecated: Function split() is deprecated"의 두 판 사이의 차이

17번째 줄: 17번째 줄:
echo "user=[$user], pass=[$pass], uid=[$uid], gid=[$gid], extra=[$extra]";
echo "user=[$user], pass=[$pass], uid=[$uid], gid=[$gid], extra=[$extra]";
// user=[root], pass=[x], uid=[0], gid=[0], extra=[root:/root:/bin/bash]
// user=[root], pass=[x], uid=[0], gid=[0], extra=[root:/root:/bin/bash]
</source>
==예제 2==
;수정 전
<source lang='php'>
<?php
$date1 = "04/30/1973";
$date2 = "04-30-1973";
list($month1, $day1, $year1) = split('[/.-]', $date1);
list($month2, $day2, $year2) = split('[/.-]', $date2);
echo "Month: $month1; Day: $day1; Year: $year1<br />\n";
echo "Month: $month2; Day: $day2; Year: $year2<br />\n";
// Month: 04; Day: 30; Year: 1973
// Month: 04; Day: 30; Year: 1973
</source>
</source>



2013년 12월 17일 (화) 14:04 판

Deprecated: Function split() is deprecated

1 예제 1

수정 전
<?php
$passwd_line = "root:x:0:0:root:/root:/bin/bash";
list($user, $pass, $uid, $gid, $extra) = split(":", $passwd_line, 5);
echo "user=[$user], pass=[$pass], uid=[$uid], gid=[$gid], extra=[$extra]";
// user=[root], pass=[x], uid=[0], gid=[0], extra=[root:/root:/bin/bash]
수정 후
<?php
$passwd_line = "root:x:0:0:root:/root:/bin/bash";
list($user, $pass, $uid, $gid, $extra) = explode(":", $passwd_line, 5);
echo "user=[$user], pass=[$pass], uid=[$uid], gid=[$gid], extra=[$extra]";
// user=[root], pass=[x], uid=[0], gid=[0], extra=[root:/root:/bin/bash]

2 예제 2

수정 전
<?php
$date1 = "04/30/1973";
$date2 = "04-30-1973";
list($month1, $day1, $year1) = split('[/.-]', $date1);
list($month2, $day2, $year2) = split('[/.-]', $date2);
echo "Month: $month1; Day: $day1; Year: $year1<br />\n";
echo "Month: $month2; Day: $day2; Year: $year2<br />\n";
// Month: 04; Day: 30; Year: 1973
// Month: 04; Day: 30; Year: 1973

3 같이 보기

4 참고 자료

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}