Step 1: Open your text editor and type the php program and the save the program as extension ".php"

Step 2: Save the php file in C:\wamp\www  

Step 3: Open your Wampserver


Step 3: In the url type http://localhost/program_name.php

How to run PHP program: 




Program


<?php
    echo "<style>
            *{
                margin: 0;
                padding: 0;
            }
            body {background: black;}
            canvas {display:block;}
        </style>
        <canvas id='canvas'></canvas>
        <script>
var def = '1100001111100010101111100001111101';
var as = '100001111100010101111100001111101;1100001111100010101111100001111101';
var as_s = '01100001111100010101111100001111101';
var en = 'fkaslf;01100001111100010101111100001111101;01100001111100010101111100001111101;01100001111100010101111100001111101;000000000000;111111010;00010;0111;01100001111100010101111100001111101';
var en_s = '01100001111100010101111100001111101';
var ru = '01100001111100010101111100001111101000111';
var ru_s = '01100001111100010101111100001111101';
var ar_s = '01100001111100010101111100001111101 ';
var ch = '01100001111100010101111100001111101';
var ch_s = '00000011;0000000;1111111111;000011111110000';

function TheMatrixRain(charset) {

    var c = document.getElementById('canvas');
    var ctx = c.getContext('2d');
    c.height = window.innerHeight;
    c.width = window.innerWidth;

    var font_size = 12;
    var columns = c.width/font_size;
    var drops = [];

    for (var x = 0; x < columns; x++) {
        drops[x] = 1;
    }

    characters = charset.split('');
   
    var rnd = drops.slice();

    setInterval(draw, 30);

    function draw() {
       
        if (Math.random() > 0.25) {
            ctx.fillStyle = 'rgba(0, 0, 0, 0.05)';
            var x_rect = Math.floor(Math.random()*c.width);
            var y_rect = Math.floor(Math.random()*c.height);
            ctx.fillRect(x_rect, y_rect, (c.width/4), ((c.height/c.height)*(font_size*10)));
        }
       
        ctx.fillStyle = 'rgba(0, 0, 0, 0.03)';
        ctx.fillRect(0, 0, c.width, c.height);
        ctx.fillStyle = '#0F0';
   
        for (var i = 0; i < drops.length; i++) {
       
         if (drops[i]*font_size < c.height) {
           
            var text = characters[Math.floor(Math.random()*characters.length)];
            var col_size = font_size;

            if (!(i%2)) {
                if(drops[i] == 1) {
                   rnd[i] = Math.random() * (1.5 - 0.7) + 0.7;    
                }
                col_size /= rnd[i];
            }

            if (!(i%3)) {
                if(drops[i] == 0) {
                   rnd[i] = Math.random() * (1.5 - 0.7) + 0.7;    
                }
               col_size /= rnd[i];
            }

           
            ctx.font = col_size + 'px arial';

            ctx.fillText(text, i*font_size, drops[i]*font_size);
           
            }

           if (drops[i]*font_size > c.height && Math.random() > 0.965) {
                ctx.fillStyle = 'rgba(0, 0, 0, 1)';
                ctx.fillRect(i*font_size, 0, font_size, c.height);
                ctx.fillStyle = 'rgba(0, 188, 0, 0.5)';
                drops[i] = 0;
               
            }
           
            drops[i]++
         
       }
       
    }
}
TheMatrixRain (en_s);
</script> ";
?>

Output:




Post a Comment

Previous Post Next Post