Php example maked
This commit is contained in:
parent
5693aa4609
commit
3580630871
27
index.php
27
index.php
@ -1,3 +1,24 @@
|
||||
<?php
|
||||
echo 'Merhaba, Dünya!';
|
||||
?>
|
||||
<?php
|
||||
// Class definition that creates an instance of a class
|
||||
class ExampleClass {
|
||||
public $exampleVariable; // a variable belonging to the class instance
|
||||
|
||||
// Constructor function, called when an object is created
|
||||
public function __construct($value) {
|
||||
$this->exampleVariable = $value; // assigns value to the instance variable
|
||||
}
|
||||
|
||||
// Function that adds two numbers
|
||||
public function add($number1, $number2) {
|
||||
return $number1 + $number2; // returns the sum
|
||||
}
|
||||
}
|
||||
|
||||
// Example function: multiplies two numbers
|
||||
function multiply($number1, $number2) {
|
||||
return $number1 * $number2; // returns the product
|
||||
}
|
||||
|
||||
// Array example
|
||||
$sampleArray = [1, 2, 3, 4, 5]; // array of numbers
|
||||
?>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user