Last active
June 27, 2016 09:10
-
-
Save CodeBrauer/3d0e7e46d968bd03831d to your computer and use it in GitHub Desktop.
some codecandies I just find sometimes...
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 | |
| // most complicated way to reformart a date... also deprecated function | |
| ereg("([0-9]{4}).([0-9]{2}).([0-9]{2})", $value['check_in'], $alter); | |
| $bdate="$alter[3].$alter[2].$alter[1]"; | |
| echo $bdate; |
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 | |
| ini_set('display_errors', '1'); error_reporting(E_ALL); | |
| session_start(); | |
| // [...] | |
| // some requires and includes that could already sent some errors... | |
| // [...] | |
| $userName = $_SESSION['user']; | |
| if(isset($userName)){ // check user is logged in (lol) | |
| }else{ | |
| header('location:index.php'); | |
| } |
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 | |
| // could be easier to get GMT Date with 2 hours added | |
| echo gmdate('D, d M Y H:i:s', mktime(date("H")+2,date("i"),date("s"),date("m"),date("d"), date("Y"))) . " GMT"; | |
| // found in an codecanyon pure php application. |
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 | |
| function konv_date($date){ | |
| $jahr = substr($date,0,4); | |
| $mon = substr($date,5,2); | |
| $tag = substr($date,8,2); | |
| $datneu = $tag.'.'.$mon.'.'.$jahr; | |
| return $datneu; | |
| // return date('d.m.Y', strtotime($date)); would do the same... and would be safer ... and faster... | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment