PHP ?!?!
·
What Can PHP Do?
- PHP can generate dynamic page content
- PHP can create, open, read, write, delete, and close files on the server
- PHP can collect form data
- PHP can send and receive cookies
- PHP can add, delete, modify data in your database
- PHP can be used to control user-access
- PHP can encrypt data
With PHP you are not limited to output HTML. You can output images, PDF files, and even Flash movies. You can also output any text, such as XHTML and XML.
What is PHP ?
- PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages.
- PHP is a widely-used, free, and efficient alternative to competitors such as Microsoft's ASP.
What we should know about PHP ?
- PHP is an acronym for "PHP: Hypertext Preprocessor"
- PHP is a widely-used, open source scripting language
- PHP scripts are executed on the server
- PHP is free to download and use
Why PHP?
- PHP runs on various platforms (Windows, Linux, Unix, Mac OS X, etc.)
- PHP is compatible with almost all servers used today (Apache, IIS, etc.)
- PHP supports a wide range of databases
- PHP is free. Download it from the official PHP resource: www.php.net
- PHP is easy to learn and runs efficiently on the server side
Basic PHP Syntax
A PHP script can be placed anywhere in the document.
A PHP script starts with <?php and ends with ?>:
<?php
// PHP code goes here?>
The default file extension for PHP files is ".php".
PHP Variables
A variable can have a short name (like x and y) or a more descriptive name (age, carname, total_volume).
Rules for PHP variables:
- A variable starts with the $ sign, followed by the name of the variable
- A variable name must start with a letter or the underscore character
- A variable name cannot start with a number
- A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
- Variable names are case-sensitive ($age and $AGE are two different variables)
Output Variables
The PHP
echo
statement is often used to output data to the screen.PHP Arithmetic Operators
The PHP arithmetic operators are used with numeric values to perform common arithmetical operations, such as addition, subtraction, multiplication etc.
Operator | Name | Example | Result | |
---|---|---|---|---|
+ | Addition | $x + $y | Sum of $x and $y | |
- | Subtraction | $x - $y | Difference of $x and $y | |
* | Multiplication | $x * $y | Product of $x and $y | |
/ | Division | $x / $y | Quotient of $x and $y | |
% | Modulus | $x % $y | Remainder of $x divided by $y | |
** | Exponentiation | $x ** $y | Result of raising $x to the $y'th power |
^.^ i used visual studio code to do this assigment but if you didnt have this program, maybe you could use online program like http://www.writephponline.com/
Let's see :
Ada seorang nasabah bank yang menabung di bank X dengan saldo awal Rp. 1.000.000,-. Bank X menerapkan kebijakan bunga 3% perbulan dari saldo awal tabungan. Hitunglah jumlah saldo akhir nasabah tersebut setelah 11 bulan. Lengkapi programnya dan tampilkan outputnya
<?php$saldoAwal = 1000000;$bunga = 0.03;$bulan = 11;$saldoAkhir = …;echo “Saldo akhir setelah “.$bulan.” bulan adalah : Rp. “.$saldoAkhir. “,-“;?>
Program |
Hasil |
ProgramII |
the function of Floor command is to................ UNTUK PEMBULATAN KE BAWAH MUEHEHEHEHEHE :v
Hasil ProgramII |
Ibu ingin mengambil uang tabungan sejumlah Rp. 1.575.250,- yang dimilikinya di sebuah bank. Misalkan pada saat itu uang pecahan yang berlaku adalah Rp. 100.000,-; Rp.50.000,-; Rp. 20.000,-; Rp. 5.000,-; Rp. 100,- dan Rp. 50. Dengan menggunakan script PHP, tentukan banyaknya masing-masing uang pecahan yang diperoleh ibu tadi!
Keterangan :
$a adalah variabel yang menyatakan jumlah pecahan Rp. 100.000,-
$b adalah variabel yang menyatakan jumlah pecahan Rp. 50.000,-
$c adalah variabel yang menyatakan jumlah pecahan Rp. 20.000,-
$d adalah variabel yang menyatakan jumlah pecahan Rp. 5.000,-
$e adalah variabel yang menyatakan jumlah pecahan Rp. 100,-
$f adalah variabel yang menyatakan jumlah pecahan Rp. 50,-
ProgramIII |
HasilProgramIII |
I have some Recommendation and References Website for more explanation about PHP :)
https://www.w3schools.com/php/ this is the best web for PHP or coding explaination
Tidak ada komentar:
Posting Komentar