Skip to content

Instantly share code, notes, and snippets.

View ilhamarrouf's full-sized avatar
🏠
Working from home

Ilham Arrouf ilhamarrouf

🏠
Working from home
View GitHub Profile
@ilhamarrouf
ilhamarrouf / angka-variabel.php
Created December 7, 2016 02:49
Variable PHP
<?php
//Penggunaan angka dalam variabel yang salah
$12345 = "contoh1";
$2morow = "contoh2";
?>
@ilhamarrouf
ilhamarrouf / const-define.php
Created December 7, 2016 03:19
Constant PHP
<?php
// cara 1 menggunakan keyword const
const nama = "Belajar Konstanta";
echo nama; // kata yang akan muncul adalah Belajar Konstanta
//cara 2 menggunakan keyword define
define ("nama" , "Belajar Konstanta");
echo nama; // kata yang akan muncul adalah Belajar Konstanta
?>
@ilhamarrouf
ilhamarrouf / ekspresi.php
Last active December 7, 2016 03:36
Expression PHP
<?php
// Semua Kode di bawah ini adalah Ekspresi PHP
$nilai1 = "87";
$nilai2 = "92";
$nilai3 = "89";
echo $nilai1 + $nilai2 * $nillai3;
// Contoh diatas merupakan suatu bentuk ekspresi yang menghasilkan nilai 87
// Angka 87, 92 dan 89 disebut sebagai operand
// Tanda + dan * disebut sebagai operator.
@ilhamarrouf
ilhamarrouf / penjumlahan.php
Last active December 7, 2016 13:43
PHP Arithmetic Operators
<?php
$x = 10;
$y = 6;
echo $x + $y; // 10 + 6 = 16 adalah hasilnya
?>
@ilhamarrouf
ilhamarrouf / pengurangan.php
Last active December 7, 2016 13:45
PHP Arithmetic Operators
<?php
$x = 10;
$y = 6;
echo $x - $y; // 10 - 6 = 4 adalah hasilnya
?>
@ilhamarrouf
ilhamarrouf / perkalian.php
Last active December 7, 2016 13:54
PHP Arithmetic Operators
<?php
$x = 10;
$y = 6;
echo $x * $y; // 10 * 6 = 60 adalah hasilnya
?>
@ilhamarrouf
ilhamarrouf / pembagian.php
Last active December 7, 2016 13:53
PHP Arithmetic Operators
<?php
$x = 10;
$y = 3;
echo $x / $y; # 10/3 = 3.3333333333333 adalah hasilnya
?>
@ilhamarrouf
ilhamarrouf / modulus.php
Last active December 7, 2016 13:06
PHP Arithmetic Operators
<?php
$x = 100;
$y = 8;
echo $x % $y; // Hasilnya 4
/* Sisa hasil bagi 100 oleh 8 adalah 4
Logikanya 8 * 12 = 96, sisa 4 dari 100 dan tidak bisa di bagi 8 lagi */
?>
@ilhamarrouf
ilhamarrouf / eksponen.php
Last active December 7, 2016 13:39
PHP Arithmetic Operators
<?php
$x = 8;
$y = 4;
echo $x ** $y;
// Hasilnya adalah 4096
// Hasil dari 8 pangkat 4 atau 8 * 8 * 8 * 8
?>
@ilhamarrouf
ilhamarrouf / leftsetright.php
Created December 7, 2016 07:50
PHP Assignment Operators
<?php
$x = 10;
echo $x;
?>