Hello every one.
I have another chalange in php. can you convert "123456789" string to "9,8,7,6,5,4,3,2,1" this string format without using string function.
first you tell this is not possible, but this is possible using array functions. See below code.
<?php
error_reporting(0);
$str="123456789";
$a=array();
for($i=0;$i<1000;$i++)
{
if($str[$i]!="")
{
array_push($a,$str[$i]);
}
else
{
break;
}
}
$exp=array_reverse($a);
$final="";
for($i=0;$i<count($exp);$i++)
{
if($i!=count($exp)-1)
{
$final.=$exp[$i].",";
}
else
{
$final.=$exp[$i];
}
}
echo $final."<br>";
?>
Using this code you will get "9,8,7,6,5,4,3,2,1".
I have another chalange in php. can you convert "123456789" string to "9,8,7,6,5,4,3,2,1" this string format without using string function.
first you tell this is not possible, but this is possible using array functions. See below code.
<?php
error_reporting(0);
$str="123456789";
$a=array();
for($i=0;$i<1000;$i++)
{
if($str[$i]!="")
{
array_push($a,$str[$i]);
}
else
{
break;
}
}
$exp=array_reverse($a);
$final="";
for($i=0;$i<count($exp);$i++)
{
if($i!=count($exp)-1)
{
$final.=$exp[$i].",";
}
else
{
$final.=$exp[$i];
}
}
echo $final."<br>";
?>
Using this code you will get "9,8,7,6,5,4,3,2,1".
It is a helpful informative post. Thanks for sharing this great information. Really worth to read all info, thanks allot again. I already bookmarked this great website.
ReplyDeleteKids website design - Custom design for pediatric doctors designed by Optimized360.com
hey nice source for us, thanks for sharing this details and i read the whole information and it is very informative and thanks for sharing this details and i bookmark this information for future use.
ReplyDeletePHP Development Company
Thanks for showing the post about of php development. This post will help me to understand how php will help me to enhance my career in web development.
ReplyDeleteHire Xamarin Mobile app Development Company Texas USA
Hey,
ReplyDeleteWhat a brilliant information you are sharing here about the relevant technology. I really appreciate your effort. I’ll visit your blog again to get some more nice information about other technologies too. Keep up the good work buddy!!
Hire Reactjs Developers
Hire Full Stack Developers texas
Live Streaming SDk
Develop Big Data Consulting Services
Node js Development Company Texas
Great post!!
ReplyDeleteKeep writing :)
mobile food ordering software
Restaurant online ordering app
Restaurant Website Ordering System
PHP Web Development Company |PHP Development Services
ReplyDeleteWoow nice blog!! Many people are looking for php web development company are you one of them ? if yes and this information for you only “intileo technologies “ one of the biggest it company in gurugram are providing various it services including php web development also!! So waiting for what just pick your mobile and call us :- 918470058143
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGood Post. I like your blog. Thanks for Sharing
ReplyDeleteCyber Security Solutions Company in Gurugram