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
| function get_content($URL){ | |
| $ch = curl_init(); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_URL, $URL); | |
| $data = curl_exec($ch); | |
| curl_close($ch); | |
| return $data; | |
| } | |
| print_r(get_content('https://abc.com/api/get-customers')); exit(); |
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
| function integersToRomanNumeral($number) | |
| { | |
| $values = [1000, 500, 100, 50, 10, 5, 1]; | |
| $romanNumerals = ['M', 'D', 'C', 'L', 'X', 'V', 'I']; | |
| $result = []; | |
| for($i = 0; $i<count($values); $i++) { | |
| while($number >= $values[$i]) { | |
| $number = $number - $values[$i]; | |
| $result[] = $romanNumerals[$i]; |
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
| $arrayData = [2,2,2,5]; | |
| $filterData = array_filter(array_count_values($arrayData), function ($value) { | |
| return $value == 1; | |
| }); | |
| print_r($filterData); |
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
| Position an image behind the text | |
| img { | |
| position: absolute; | |
| left: 0px; | |
| top: 0px; | |
| z-index: -1; | |
| } | |
| <h1>This is a heading</h1> |
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
| Use of $_SERVER['HTTP_REFERER']; | |
| I assume in a.php | |
| <?php | |
| session_start(); | |
| $_SESSION['hello'] = "Your content here"; | |
| ?> | |
| In b.php you want to show your session data and you are also checking what is the previous page |
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
| <form method="POST" action="myurl"> | |
| <span class="btn btn-success fileinput-button"> | |
| <span>Select file</span> | |
| <input type="file" name="file"/> | |
| </span> | |
| </form> | |
| /*Copied from bootstrap */ |
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
| Here is a simple textarea: | |
| <textarea name="content" id="content" class="form-control"></textarea> | |
| Textarea will be expandable based on content height and also for content pasting. | |
| $('textarea#content').on('keyup input', function() { | |
| resizeTextarea(this); | |
| }); |