Skip to main content

Write a PHP script to print current PHP version



<?php
echo 'Current PHP version : ' . phpversion();
?>


 Write a PHP script to redirect a user to a different page .


<?php
header('Location:http://www.google.com');
?>

Write a PHP script to get last modified information of a file.


<?php
$file_last_modified = filemtime(basename($_SERVER['PHP_SELF']));   
echo "Last modified " . date("l, dS F, Y, h:ia", $file_last_modified);  
?>

Comments

Popular posts from this blog

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.

$var = 'PHP Tutorial'. Put this variable into the title section, h3 tag and as an anchor text within a HTML document.  <?php echo "<html>"; echo "<head>"; echo "<title>"; echo "PHP TUTORIAl"; echo "</title>"; echo "<body>"; echo "<h3>PHP TUTORIAL</h3>"; echo "<hr>"; echo "<p>PHP, an acronym for Hypertext Preprocessor, is a widely-used open source general-purpose scripting language. It is a cross-platform, HTML embedded server-side scripting language and is especially suited for web development.</p>"; echo "</body>"; echo "</head>"; echo "</html>"; ?> Output:

Write a PHP script, which change the color of first character of a word.

Write a PHP script, which change the color of first character of a word. <?php   $text = 'PHP Tutorial';   $text = preg_replace('/(\b[a-z])/i','<span style="color:red;">\1</span>',$text);   echo $text;   ?>