This file contains hidden or 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 | |
| foreach (range(1,4) as $index) { | |
| $arr[] = date("m/Y", strtotime("-{$index} months")); | |
| } | |
| echo implode("\n", $arr); |
This file contains hidden or 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
| task_num = 1 | |
| # total task number dia bagi 1 | |
| def questions(): | |
| # Function bernama 'questions' | |
| print ("Please select symbol") | |
| # Print keluar text di atas. | |
| symbol = input() | |
| # Prompt input dan lepas tu input value dari user dalam variable 'symbol' |
This file contains hidden or 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
| task_num = 1 | |
| def questions(): | |
| print ("Please select symbol") | |
| symbol = input() | |
| print ("'{}' has been selected as the symbol.".format(symbol)) | |
| print ("Please specify the height") | |
| height = input() |
This file contains hidden or 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 = "Ram Is Good Boy"; | |
| $reversed = implode(" ", array_map('ucfirst', ( array_reverse( explode(" ", strrev(strtolower($string))))) )); | |
| echo $reversed; |
This file contains hidden or 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
| class AuthenticateController extends Controller | |
| { | |
| public function index() | |
| { | |
| } | |
| public function authenticate(Request $request) | |
| { |
This file contains hidden or 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 = "A,B,C,D,'1,2,3,4,5,6',F,G"; | |
| $boom = explode("'", $string)[1]; | |
| $new_string = str_replace($boom, "", $string); | |
| foreach (explode(",", $new_string) as $letter) { | |
| if ($letter != "''") { |
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title></title> | |
| <script src="https://code.jquery.com/jquery-2.1.4.js"></script> | |
| <script> | |
| $(function() { | |
| $("#clickMe").on('click', function() { | |
| var menu = "<label>Name</label><input type='text' name='name[]'>"; |
This file contains hidden or 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 | |
| $input = "was it a car or a cat I saw?"; | |
| $input = preg_replace("/[^a-zA-Z0-9]/", "", $input); | |
| $string = strtolower(implode("", str_split(str_replace(' ', '', $input)))); | |
| $evenOrOdd = function($string) { | |
| return (strlen($string) % 2 == 0) ? "even" : "odd"; |
This file contains hidden or 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 $retardadize = function($string, $firstRetard) {$each = str_split(strtolower($string));$ultimateRetardSolution = "";$retardPotion = ($firstRetard) ? true : false;foreach ($each as $x ) {if ($retardPotion) {$ultimateRetardSolution .= strtoupper($x);$retardPotion = (ctype_space($x)) ?: false;} else {$ultimateRetardSolution .= strtolower($x);$retardPotion = (ctype_space($x)) ?: true;}}return $ultimateRetardSolution;};echo $retardadize("Hello World", true); |
This file contains hidden or 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 | |
| $retardadize = function($string, $firstRetard) { | |
| $each = str_split(strtolower($string)); | |
| $ultimateRetardSolution = ""; | |
| $retardPotion = ($firstRetard) ? true : false; | |
| foreach ($each as $x ) { | |
| if ($retardPotion) { |