Skip to content

Instantly share code, notes, and snippets.

View klapuch's full-sized avatar
😊
Exploring world through OOP

Dominik Klapuch klapuch

😊
Exploring world through OOP
  • ČSFD
  • Czech Republic
View GitHub Profile
@klapuch
klapuch / Dockerfile
Created January 14, 2018 12:48
php:7.2-rc-zts-alpine +pthreads +xdebug
FROM php:7.2-rc-zts-alpine
ARG APP_USER_USERNAME=app
RUN apk update && apk add --no-cache \
sudo bash \
g++ make autoconf \
libxml2-dev icu-dev curl-dev pcre-dev
RUN adduser -D -s /bin/bash $APP_USER_USERNAME \
@klapuch
klapuch / php_object_to_array.php
Created August 6, 2016 22:09 — forked from victorbstan/php_object_to_array.php
recursively cast a PHP object to array
<?php
/*
This function saved my life.
found on: http://www.sitepoint.com/forums//showthread.php?t=438748
by: crvandyke
It takes an object, and when all else if/else/recursive functions fail to convert the object into an associative array, this one goes for the kill. Who would'a thunk it?!
*/
$array = json_decode(json_encode($object), true);
@klapuch
klapuch / dateformatting-intl.php
Created June 15, 2016 14:22 — forked from nyamsprod/dateformatting-intl.php
Formatting Date in PHP
<?php
echo IntlDateFormatter::formatObject(
new DateTime(), //a DateTime object
"eeee dd MMMM yyyy '@' hh:mm:ss", //UCI standard formatted string
'fr_FR' //the locale
);
@klapuch
klapuch / check-date.php
Last active March 19, 2016 18:23
Check if given data is valid DATETIME or not
<?php
function isDateTime($input): bool {
return date('Y-m-d H:i:s', strtotime($input)) === $input;
}