php url function example urlencode - encoding url
urlencode() function returns a string in which all non-alphanumeric characters except -_. have been replaced. we would like to test urlencode() function by passing a sting variable to it.
php-url-function-example-urlencode.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>php url function example urlencode - encoding url</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="Author" content="Md Iqbal Hosan">
<meta name="title" content="php url function example urlencode - encoding url - returns a string in which all non-alphanumeric characters except -_. have been replaced">
<meta name="keywords" content="php, example, code, urlencode">
<meta name="description" content="php url function example urlencode - encoding url - returns a string in which all non-alphanumeric characters except -_. have been replaced">
<style>
h2, h4{background:orange; color:#000085;}
h2{ padding:3px; margin:3px; font-size:22px;}
h4{ padding:2px; margin:2px; font-size:18px;}
p{padding:2px; margin:2px; color:#0099Fe;}
body{ background:#FFFFFc;}
</style>
</head>
<body>
<h2>php url function example urlencode - encoding url</h2>
<?php $MyFavoriteColor = "my favorite color is orange."; ?>
<h3>MyFavoriteColor = <?php echo $MyFavoriteColor; ?></h3>
<?php
/*
------------------------------------------------------------------------
encodeing the given string by using urlencode() php url function
------------------------------------------------------------------------
*/
$EncodedFavoriteColor = urlencode($MyFavoriteColor);
?>
<h3>EncodedFavoriteColor = <?php echo $EncodedFavoriteColor; ?></h3>
</body>
</html>
php url function example urlencode - encoding url - output in the browser
No comments:
Post a Comment
leave your comments here..