corecodeschool.blogspot.com: String function in php

Enter Keyword Hear for Search This Blog

Showing posts with label String function in php. Show all posts
Showing posts with label String function in php. Show all posts

Saturday, 23 April 2016

String function in php

echo

<?php
echo " A value is ";
$a=4;
echo $a;
?>


chr

<?php
echo chr(65);
echo "<br/>";
echo chr(122);
?>


strlen

<?php
$pwd="abc@123";
if(strlen($pwd)<6)
{
echo "password to short";
}
?>


ord

<?php
echo ord(' ');
echo "<br/>";
echo ord('z');
?>

print

<?php
print " A value is ";
$a=4;
print $a;
?>

strtoupper

<?php
echo strtoupper('hello');
echo "<br/>";
echo strtoupper('world');
?>

strtolower

<?php
echo strtolower('HEllo');
echo "<br/>";
echo strtolower('WORLD');
?>


substr

<?php
$a="harsukh k k";
$b=strlen($a);
for($i=0;$i<=9;$i++){
$j=substr($a,$i,1);
$d=ord($j);
echo $d;
echo"<br />";
echo $j;
}


?>

chop

<?php
     $str = "Hello World!";
     echo $str . "<br>";
     echo chop($str,"World!");
?>

join

<?php
$arr = array('Hello','World!','Beautiful','Day!');
echo join(" ",$arr);
?>

parse_str

<?php
parse_str("name=Peter&age=43");
echo $name."<br>";
echo $age;
?>

Featured post

Contact

Contact Core Code School Core Code School shares beginner-friendly tutorials on PHP, HTML, CSS, JavaScript, Java, SQL and Ubuntu. You can...