PHP str_pad() Function with Examples

Program 1

<html>
    <head><title>String in PHP Application</title>
    <body>
  
  <pre>
    <center>
<?php
            $mystr="Data Flair"; 
            $mystr1=str_repeat($mystr,5);
             echo $mystr1."<br>";
            // $newstr1=str_pad($mystr,20,'.',STR_PAD_LEFT);
            // $newstr2=str_pad($mystr,20,'.',STR_PAD_BOTH);
            // $newstr3=str_pad($mystr,20,'.',STR_PAD_RIGHT);
            // echo $newstr1."<br>";
            // echo $newstr2."<br>";
            // echo $newstr3."<br>";
?>
        
</pre>
        </center>
</body>
</html>

 

courses

Leave a Reply

Your email address will not be published. Required fields are marked *