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 | |
header('content-type: text/plain; charset=utf-8'); | |
// Display triangle | |
$str_arr=array(); | |
for($i=1; $i<=5; $i++){ | |
if( $i == 3 || $i == 4 ){ | |
$str_arr[]= "#"; | |
$result= $str_arr; | |
$total_str= count($result)-1; | |
foreach( $result as $key=>$value ){ |
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
// Laravel 5.2 | |
### Daftarkan Events dan Listeners untuk Event dengan nama yaitu "Illuminate\Database\Events\QueryExecuted" ke EventServiceProvider | |
--- SOURCE CODE | |
app\Providers\EventServiceProvider.php | |
class EventServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any other events for your application. | |
* |
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
// Laravel 5.2 | |
### Registering Events and Listeners for Event Name is "Illuminate\Database\Events\QueryExecuted" to EventServiceProvider | |
--- SOURCE CODE | |
app\Providers\EventServiceProvider.php | |
class EventServiceProvider extends ServiceProvider | |
{ | |
/** | |
* Register any other events for your application. | |
* |
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 | |
// page2.php | |
session_start(); | |
echo 'Welcome to page #2<br />'; | |
echo $_SESSION['old_session']; | |
echo $_SESSION['favcolor']; // green | |
echo $_SESSION['animal']; // cat |
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 | |
// page1_use_trans_sid_true.php | |
// Browser Cookies di block dulu | |
// Settings > Content settings > Cookies > Block sites from setting any data | |
//ini_set('session.use_only_cookies', 0); | |
ini_set('session.use_trans_sid', 0); | |
//session_cache_expire(1); |
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 | |
ob_start(); | |
$fp = fopen('php://output', 'w'); | |
foreach ($rows as $row) { | |
// Add row to CSV buffer | |
fputcsv($fp, $row); | |
} | |
fclose($fp); |
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
===================================================================================== | |
### Using AJAX on the Laravel Form ### | |
===================================================================================== | |
### Importing or Aliasing the following Class Name using use operator | |
use Illuminate\Http\JsonResponse; | |
### | |
### Modify Validation Class which extends from Request |
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
===================================================================================== | |
### Setup Apache Virtual Host ### | |
===================================================================================== | |
### Create new file local.conf ( Virtual Host Configuration File ) | |
--- Go to /etc/apache2/sites-available/ --- | |
--- Create new file local.conf --- |
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 | |
error_reporting(E_ALL); | |
$charsets = array( | |
"ISO-8859-1" => "Western European, Latin-1. ", | |
"ISO-8859-5" => "Little used cyrillic charset (Latin/Cyrillic). ", | |
"ISO-8859-15" => "Western European, Latin-9. Adds the Euro sign, French and Finnish letters missing in Latin-1 (ISO-8859-1). ", | |
"UTF-8" => "ASCII compatible multi-byte 8-bit Unicode. ", | |
"cp866" => "DOS-specific Cyrillic charset. ", |
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 | |
define("CURRENCY_PREFIX", "Rp"); | |
define("CURRENCY_SEPARATOR", "."); | |
define("CURRENCY_DECIMAL", ","); | |
$number = 1234.56; | |
// Change Number into Currency with thousand separator and Identifier | |
$indonesian_format_number = number_format($number, 2, CURRENCY_DECIMAL, CURRENCY_SEPARATOR); | |
$indonesianFormatNumberWithRP= CURRENCY_PREFIX . $indonesian_format_number; |
NewerOlder