Skip to content

techtanzeel/Js_Vs_Php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

JS vs PHP Syntax

Print data

// js
console.log('hello');
// php
echo 'hello';

Variable assignment

// js
var x = 1;
// php
$x = 1;

Constant assignment

// js
const X = 1; 
// php
define('X', 1);

Assigning a value to multiple variables

// js
var one, two, three = [];
// php
$one = $two = $three = [];

Array creation

// js
var x = [];
// php
$x = [];
$x = array()

Key/value storage

// js
var x = {
    name: 'Weltall',
    age: 50
};
// php
$x = [
    'name' => 'Weltall',
    'age'  => 50
];

Foreach Loop

// js
x.forEach(function(y) { });
// php
foreach(x as y) {}

About

Common Js vs PHP Syntax

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published