Posts

Showing posts with the label PHP

PHP Character and Word Count

PHP Character and Word Count This program written with PHP will echo the character count for each character as well as the work count for the entered string. PHP <?php     $string = "this php code will tell us the frequency of each letter in this string including spaces";      $words = str_word_count($string);      $chart = count_chars($string, 1);      foreach($chart as $letter=>$frequency) echo "Character ".chr($letter)." appears $frequency times<br />";      echo "Total words in string: $words"; ?> Click here to run this Code More Free Code Examples Free Social Media Template HTML Color Selector Speed Test Try these Fun Games by Bobbie: Ocean Treasures Game Travel Blast Game New York Play and Learn Russian Battlestarship Game Take a look at these Groovy Codes: Fun IQ Test Html...

PHP Current Calender

Image
This Code Creates this Months Current Calendar using PHP PHP <?php     echo "<HTML>\n" . " <HEAD>\n" . " <STYLE>\n" . "BODY, TD, TH\n" . "{\n" . " font-family: Verdana;\n" . " font-size: 15pt;\n" . "}\n" . " </style>\n" . " </head>\n" . " <BODY>\n";      $month = "";      if ($month == "" || $year == "") { $this_month = date("n"); $month_name = date("F"); $this_year = date("Y"); }             else { $this_month = date("n", mktime(0, 0, 0, $month, 1, $year)); $month_name = date("F", mktime(0, 0, 0, $month, 1, $year)); $this_year = date("Y", mktime(0, 0, 0, $month, 1, $year)); }  $last_month = $this_month - 1; $next_month = $this_month + 1;              if ($last_month == 12) $last_year = $this_year - 1; else $last...

8 Codes to Find Versions

Image
The following is a collection of Codes used to Determine the Language or Compiler Version being used.    *The following Featured Codes were Created by  John Wells PHP Version <?php echo "PHP Version ".phpversion()."<br>"; ?> Click here to run this code Java Version public class Program {   public static void main(String[] args) {     System.out.format("Java Version = '%s'",         System.getProperty("java.version"));   } } Click here to see this code run Swift Version #if swift(>=4.2)  print("Running Swift 4.2 or later") #else #if swift(>=4.1)  print("Running Swift 4.1") #else #if swift(>=4.0)  print("Running Swift 4.0") #else  print("Running Swift earlier than 4.0") #endif #endif #endif Click here to run this code Ruby Version print "ruby #{ RUBY_VERSION }p#{ RUBY_...

PHP with HTML, CSS, and JavaScript

Image
This is a great example of how to get PHP, HTML, CSS, and JavaScript working together beautifully.      * Featured Code Example Created and submitted by  Biel Blue via Sololearn. <HEAD> <style> body{ background-color:#33ff99; } h1{      margin-top:20px;      border: dashed 10px #3f3;      border-radius:15px;      background-color: #3f3; } p{      background-color: #ccff00;      font-size:18pt;      padding:10px;      border: solid #ddff00 1px;      border-radius: 15px;       } div{      background-color:#33aaff;      padding:10px;      font-size:18pt;      font-weight:700;      border: solid 1px #33aaf...

Hello World in 10 Programming Languages

Image
Java Hello World public class Hello {       public static void main(String[] args){           System.out.println("Hello World!");} } Click here to see this code run HTML5 Hello World <!DOCTYPE html> <html>     <head>         <title>Page Title</title>     </head>     <body>         <h1>Hello World</h1>     </body> </html> Click here to run this code Python Hello World print("Hello World") Click here to see this code run C Hello World #include <stdio.h> int main() { printf("Hello World");      return 0;} Click here to see this code run C++ Hello World #include <iostream> using namespace std; int main() { cout << "Hello W...