Skip to main content

PHP: Introduction Operator

Table of arithmetic operators


Sample Script aritmatika.php

<? php 
$ value1 = 32; 
$ value2 = 8; 
$ number = $ value1 + $ value2; 
$ less = $ nilai1- $ value2; 
$ time = $ value1 * $ value2; 
$ to = $ value1 / $ value2; 
$ remainder = $ value1% $ value2; 
print "Reviews Arithmetic operation Example"; 
print "The value \ $ value1 = $ value1 and \ $ value2 = $ nilai2 <br>"; 
print "\ $ value1 + \ $ value2 = $ amount most"; 
print "\ $ value1 - \ $ value2 = $ less than most"; 
print "\ $ value1 * \ $ value2 = $ times the most"; 
print "\ $ value1 / \ $ value2 = $ for most"; 
print "\ $ value1% \ $ value2 = $ leftovers most"; 
?>

The result:

Know the assigment operator

The following table of symbols and Functions of the assignment operator used

Example Scripts assignment.php

<?php
$data1=10;
$data1+=2;

print "Nilai \$data1 adalah $data1 <br><br>";
$data2=10;
$data2-=5;

print "Nilai \$data2 adalah $data2 <br><br>";
$data3=10;
$data3*=4;

print "Nilai \$data3 adalah $data3 <br><br>";
$data4=20;
$data4/=5;

print "Nilai \$data4 adalah $data4 <br><br>";
$data5=12;
$data5%=7;

print "Nilai \$data5 adalah $data5";
?>

The result:



Know Comparison Operators

Table of comparison operators such as below
Example Scripts perbandingan.php

<?php
$a=12;
$b=13;

print "Variabel \$a = $a dan \$b = $b <br><br>";

print("Nilai \$a == \$b adalah %s <br>",$a==$b);
print("Nilai \$a <> \$b adalah %d <br>",$a<>$b);
print("Nilai \$a > \$b adalah %d <br>",$a>$b);
print("Nilai \$a < \$b adalah %d <br>",$a<$b);
print("Nilai \$a <= \$b adalah %d <br>",$a<=$b);
print("Nilai \$a >= \$b adalah %d <br><br>",$a>=$b);

print"Keterangan:<br>";
print "Nilai 1 berarti Benar/True<br>";
print "Nilai 0 berarti Salah/False";

?>

There are other operators are included in the category of comparison operators are ternary operator " ?". The use of the ternary operator is identical to the user if .. else . Pnggunaan example of the ternary operator is as follows:

Example Scripts ternary.php
























The result:


Know the String Operator

There are two types of operators used string operators . (Dot) operator . = (Colon equals) operator concatenate the arguments sent word to say that the right in an argument. While the operator . =Concatenate the arguments with a right hand to the left. The second function is similar operator to concatenate the words before and after. But the use of the operator. = More practical and operational results can be saved to the same variable. For more details, you can try the following script program. script String.php



<?php
$a="Selamat ";
$b=$a."Datang";
print "$b <br>";
$a="Selamat"; $b.="";print "$b<br>";
?>


The result:








If you have any questions please comment. 

Comments

Popular posts from this blog

Contoh Program C++ : Konversi Bilangan Hexadesimal, Oktal , Biner.

Hai Pembaca FajarYusuf.Com yang pintar dan berwawasan tinggi, kali ini FajarYusuf.Com akan post Contoh Program C++ : Konversi Bilangan Hexadesimal, Oktal , Biner . Mari kita membuat program konversi bilangan yang sangat mudah di buat dengan menggunakan bahasa pemrograman C++. Yaitu dengan menggunakan type data long, untuk Hexadesimal dengan rumus : <<hex<<desimal (merubah dari bilangan Desimal ke Hexadesimal) , untuk Oktal dengan rumus : <<oct<<desimal (merubah dari bilangan Desimal ke Oktal). Dan untuk biner dilakukan pembagian 2. Contoh Coding Program C++ Konversi Bilangan: #include<iostream> using namespace std; int main() { long desimal, pembagi=1073741824, bit; cout<<"Nilai Desimal : "; cin>>desimal; cout<<"Hexadesimal = "<<hex<<desimal<<endl; cout<<"Oktal = "<<oct<<desimal<<endl;
Les rumeurs sur les rencontres avec RM ont d’abord été propagées par un YouTuber, qui a déclaré que RM sortait avec une femme du cercle non-célébrité, mais qu’elle était riche.  La rumeur est née à cause d’une photo de RM avec un caniche, qui aurait appartenu à la femme. Les rumeurs se sont rapidement propagées sur internet et ont fait se demander nombre de fans: est-il vrai que le leader du groupe BTS a un amant? RM a ensuite répondu aux rumeurs via Weteverse jeudi 30/12/201. “Je ne connais pas du tout cette personne. Le caniche est le caniche de mon ami,” a déclaré RM, cité à partir d’un t weet  appartenant à @btsinthemoment. namjoon weverse moment 🐨 i dont know the person at all and the poodle is my friends poodle ^^; pic.twitter.com/okz0AIpVnc — 윤서⁷ (@btsinthemoment) December 31, 2021 Big Hit a également nié les allégations dans une déclaration publiée par  AllKPop .  “Les rumeurs de rencontres sur RM ne sont pas vraies,” a déclaré Big Hit, vendredi (31/12). Et apparemment, dans

Opisyal na Inilabas ni Adele ang Bagong Album na "30"

Opisyal na inilabas ni Adele ang kanyang pinakabagong album na pinamagatang “30” noong Biyernes (11/19/2021).  Nakatanggap ang bagong album ng mgapositibong pagsusuri mula sa mga kritiko ng musika. Ayon sa Rolling Stone , ang “30” ay ang pinakamahusay na album ni Adele. Mayroong 12 kanta sa “30” album na ito, isa na rito ang hit single na pinamagatang  Easy On Me .  Sa simula ng album, maririnig mo ang  Strangers By Nature— isang kantang puno ng patula na liriko. At sa dulo ay ang kantang  Love Is A Game , na nagsasalaysay ng karanasan ni Adele sa sakit na dulot ng pag-ibig. Sa  Metacritic  , nakatanggap ang bagong album ni Adele ng  metascore  na 89% mula sa 12  review  at nasa numero 8 sa listahan ng  Best Albums ng 2021 .  Habang nasa Apple Music Indonesia, ang LP “30” ay unang niraranggo sa Mga   Nangungunang Album. Adele sa British Vogue magazine (instagram.com/britishvogue). Ang album na ito ay inspirasyon ng diborsiyo ni Adele kay Simon Konecki. Sa isang pakikipanayam sa