[CODE]<?php
$array = array('step one', 'step two', 'step three', 'step four');
// by default, the pointer is on the first element
echo current($array)."<br/>
"; // step "one"
// skip two steps
next($array);
next($array);
echo current($array)."<br/>
"; // "step three"
// reset pointer, start again on step one
reset($array);
echo current($array)."<br/>
"; // "step one"
?>[/CODE]
[CODE]<?php
$str = "Is your name O'reilly?";
// Outputs: Is your name O'reilly?
echo addslashes($str);
?>[/CODE]
' " 앞의 를 제거한다.
[CODE]<?php
$str = "Is your name O'reilly?";
// Outputs: Is your name O'reilly?
echo stripslashes($str);
?>[/CODE]
다음 글자를 바꾼다(escape).
'&' (ampersand) becomes '&'
'"' (double quote) becomes '"' when ENT_NOQUOTES is not set.
''' (single quote) becomes ''' only when ENT_QUOTES is set.
'<' (less than) becomes '<'
'>' (greater than) becomes '>'
[CODE]<?php
$info = array('coffee', 'brown', 'caffeine');
// Listing all the variables
list($drink, $color, $power) = $info;
print "$drink is $color and $power makes it special.
";
// Listing some of them
list($drink, , $power) = $info;
print "$drink has $power.
";
// Or let's skip to only the third one
list( , , $power) = $info;
print "I need $power!
";
?>[/CODE]