This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var liste = ["Elma", "Armut", "Portakal", "Muz", "Kivi", "Karpuz", "Çilek"]; | |
liste.sort(function(a, b){return a.localeCompare(b)}); | |
alert(liste); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file_name = "data.csv"; | |
header("Content-Description: File Transfer"); | |
header("Content-Disposition: attachment; filename=$file_name"); | |
header("Content-Type: application/csv"); | |
$file = fopen('php://output', 'w'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- https://www.php.net/manual/en/function.get-included-files.php | |
- https://www.php.net/manual/en/function.get-declared-classes.php | |
- https://www.php.net/manual/en/function.get-defined-functions.php | |
- https://www.php.net/manual/en/function.get-defined-vars.php | |
- https://www.php.net/manual/en/function.get-loaded-extensions.php | |
- https://www.php.net/manual/tr/function.get-defined-constants.php | |
- https://www.php.net/manual/en/function.get-declared-traits.php | |
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$placeholder = "Nurullaha"; | |
echo $firstName ?? $username ?? $placeholder ?? "Guest"; | |
echo $x ?? $y ?? 'c'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$var1 = 10; | |
$var2 = 3; | |
$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) { | |
echo $var1; | |
}; | |
$closureWithArgsAndVars(8, 9); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* http://php.net/manual/tr/function.cal-days-in-month.php | |
*/ | |
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003); // 31 | |
echo "2003 yılı Ağustos ayında $num gün vardır"; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// capture the start time | |
$start_time = microtime(true); | |
// do some stuff | |
// ... | |
// display how long the script took | |
echo "execution took: ". | |
(microtime(true) - $start_time). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = | |
"Lorem ipsum dolor sit amet, consectetur | |
adipiscing elit. Nunc ut elit id mi ultricies | |
adipiscing. Nulla facilisi. Praesent pulvinar, | |
sapien vel feugiat vestibulum, nulla dui pretium orci, | |
non ultricies elit lacus quis ante. Lorem ipsum dolor | |
sit amet, consectetur adipiscing elit. Aliquam | |
pretium ullamcorper urna quis iaculis. Etiam ac massa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
print_r(getrusage()); | |
/* prints | |
Array | |
( | |
[ru_oublock] => 0 | |
[ru_inblock] => 0 | |
[ru_msgsnd] => 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// get all php files | |
$files = glob('*.php'); | |
print_r($files); | |
/* output looks like: | |
Array | |
( | |
[0] => phptest.php |
NewerOlder