i have a variable $upper.
i have created a table of 2 rows and 2 columns.
the value of the variable is as
$upper ="pakistan";
now i want to display the value of this variable in the table in the upper case form.
how to do this?
here is my code please notify me where i am wrong.
<html>
<head>
<title>Variables Type<?php echo "$page";?></title>
</head>
<body>
<?php
$upper ="pakistan";
$replace1into2 ="He is the best";
$subtract =("hello,2,4");
$occurances ="pakistan is my country. i love pakistan.";
$s ="abc abc";
$firstupper ="tassadduq hussain";
$eachupper ="my name is tassadduq";
?>
<?php
echo "<table width='80%' border='1'>
<tr>
<td bgcolor=666666>Orignal Values</td>
<td bgcolor=666666>Result</td>
</tr>
<tr>
<td>echo "strtoupper ("$upper")";</td>
<td> </td>
</tr>
</table>";
?>
</body>
</html>
how to convert variable value from lower case to upper case
Moderator: General Moderators
Re: how to convert variable value from lower case to upper case
thnaks for views
i tried it again and again
and finally do it.
i create two variable
$upper ="pakistan";
$upperresult =strtoupper ("$upper");
and simply echo the $upperresult.
here is correct code but if anyone have easy way to do this then please reffer me.
i tried it again and again
and finally do it.
i create two variable
$upper ="pakistan";
$upperresult =strtoupper ("$upper");
and simply echo the $upperresult.
here is correct code but if anyone have easy way to do this then please reffer me.
<html>
<head>
<title>Variables Type<?php echo "$page";?></title>
</head>
<body>
<?php
$upper ="pakistan";
$upperresult = strtoupper ("$upper");
?>
<?php
echo "<table width='80%' border='1'>
<tr>
<td bgcolor=666666>Orignal Values</td>
<td bgcolor=666666>Result</td>
</tr>
<tr>
<td>$upperresult</td>
<td> </td>
</tr>
</table>";
?>
</body>
</html>
Re: how to convert variable value from lower case to upper case
If you have a bunch of html that you want printed with some php values in there, you should probably do...Tassadduq wrote:thnaks for views
i tried it again and again
and finally do it.
i create two variable
$upper ="pakistan";
$upperresult =strtoupper ("$upper");
and simply echo the $upperresult.
here is correct code but if anyone have easy way to do this then please reffer me.
<html>
<head>
<title>Variables Type<?php echo "$page";?></title>
</head>
<body>
<?php
$upper ="pakistan";
$upperresult = strtoupper ("$upper");
?>
<?php
echo "<table width='80%' border='1'>
<tr>
<td bgcolor=666666>Orignal Values</td>
<td bgcolor=666666>Result</td>
</tr>
<tr>
<td>$upperresult</td>
<td> </td>
</tr>
</table>";
?>
</body>
</html>
Code: Select all
...
<?php
$upper ="pakistan";
$upperresult = strtoupper ("$upper");
?>
<table width='80%' border='1'>
<tr>
<td bgcolor=666666>Orignal Values</td>
<td bgcolor=666666>Result</td>
</tr>
<tr>
<td><?php echo $upperresult; ?></td>
<td> </td>
</tr>
</table>
...
Re: how to convert variable value from lower case to upper case
for what i use this?
my function is used for converting lower case words to upper case only.
here is all code of my page.
in this page i just create a table of five rows and two columns.
first row contains the name of fields.
first column contains the original values and second column function result.
my function is used for converting lower case words to upper case only.
here is all code of my page.
in this page i just create a table of five rows and two columns.
first row contains the name of fields.
first column contains the original values and second column function result.
Code: Select all
<html>
<head>
<title>Variables Type<?php echo "$page";?></title>
</head>
<body>
<?php
$upper ="pakistan";
$upperresult = strtoupper ("$upper");
$replace1into2 ="Respect Your Elders";
$replace1into2result =strtr ($replace1into2, "Y", "F");
$subtract ="Table";
$subtractresult =substr ("$subtract",1);
$occurance ="Pakistan is my country. i love Pakistan.";
$occurancewith ="Pakistan";
$occuranceresult = substr_count ($occurance, $occurancewith);
$s ="abc abc";
$firstupper ="tassadduq hussain";
$eachupper ="my name is tassadduq";
?>
<?php
echo "<table width='80%' border='1'>
<tr>
<td bgcolor=666666>Orignal Values</td>
<td bgcolor=666666>Result</td>
</tr>
<tr>
<td>$upper</td>
<td>$upperresult</td>
</tr>
<tr>
<td>$replace1into2</td>
<td>$replace1into2result</td>
</tr>
<tr>
<td>$subtract</td>
<td>$subtractresult</td>
</tr>
<tr>
<td>$occurance</td>
<td>The word Pakistan is written $occuranceresult times</td>
</tr>
</table>";
?>
</body>
</html>Re: how to convert variable value from lower case to upper case
why not to user
instead of
Code: Select all
strtoupper("anything");Code: Select all
$str = "anything";
strtoupper("$str");