- array_pop
- pop
1 JavaScript[ | ]

JavaScript
Copy
var fruits = ["Banana", "Orange", "Apple", "Mango"];
var fruit = fruits.pop();
console.log( fruit );
// Mango
console.log( fruits );
// ["Banana", "Orange", "Apple"]
2 PHP[ | ]

PHP
Copy
$arr = ['A', 'B', 'C'];
$str = array_pop($arr);
print_r($str);
# C
print_r($arr);
# Array
# (
# [0] => A
# [1] => B
# )
3 Python[ | ]
Python
Copy
arr = ['A', 'B', 'C']
str = arr.pop()
print( str )
# C
print( arr )
# ['A', 'B']
Python
Copy
arr = ['A', 'B', 'C']
str = arr.pop(1)
print( str )
# B
print( arr )
# ['A', 'C']
4 Perl[ | ]
Perl
Copy
my @arr = ('A', 'B', 'C');
my $str = pop @arr;
print $str . "\n";
# C
print @arr;
# AB
5 같이 보기[ | ]
편집자 Jmnote Ykhwong Jmnote bot
로그인하시면 댓글을 쓸 수 있습니다.