Skip to content

Instantly share code, notes, and snippets.

View nurullahisik's full-sized avatar
😎
funny

NURULLAH IŞIK nurullahisik

😎
funny
View GitHub Profile
<?php
// get all php files
$files = glob('*.php');
print_r($files);
/* output looks like:
Array
(
[0] => phptest.php
@nurullahisik
nurullahisik / getrusage.php
Last active March 1, 2019 08:06
For this, we are going to utilize the getrusage() function. Keep in mind that this is not available on Windows platforms.
<?php
print_r(getrusage());
/* prints
Array
(
[ru_oublock] => 0
[ru_inblock] => 0
[ru_msgsnd] => 2
<?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
<?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).
<?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";
?>
<?php
$var1 = 10;
$var2 = 3;
$closureWithArgsAndVars = function ($arg1, $arg2) use ($var1, $var2) {
echo $var1;
};
$closureWithArgsAndVars(8, 9);
<?php
$placeholder = "Nurullaha";
echo $firstName ?? $username ?? $placeholder ?? "Guest";
echo $x ?? $y ?? 'c';
@nurullahisik
nurullahisik / gist:ec6b41af6e0d7152a8eb8296f895b6ee
Created May 31, 2019 06:28
PHP de işe yarar bir kaç fonksiyon...
- 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
-
<?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');
var liste = ["Elma", "Armut", "Portakal", "Muz", "Kivi", "Karpuz", "Çilek"];
liste.sort(function(a, b){return a.localeCompare(b)});
alert(liste);