<!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Listing 8.3 Dividing a string into
tokens with strtok()</title>
</head>
<body>
<div>
<?php
$test = "http://p24.corrosive.co.uk/tk.php";
$test .= "?id=353&sec=44&user=harry&context=php";
//sajat sor:
print "$test<br/><br/>";
//
$delims = "?&";
$word = strtok( $test, $delims );
while ( is_string( $word ) ) {
if ( $word ) {
print "$word<br/>";
}
$word = strtok( $delims );
}
?>
</div>
</body>
</html>
Eredmény:
http://p24.corrosive.co.uk/tk.php?id=353&sec=44&user=harry&context=phphttp://p24.corrosive.co.uk/tk.php
id=353
sec=44
user=harry
context=php
Nincsenek megjegyzések:
Megjegyzés küldése