Skip to content

Instantly share code, notes, and snippets.

<?php
class Database {
public $isConn;
protected $datab;
//connect db
public function __construct($username = "root", $password = "", $host = "localhost", $dbname = 'copart', $options = []){
$this->isConn = TRUE;
try {
@spacebit-official
spacebit-official / PHPExcel_db_to_Excel.php
Created November 17, 2017 00:37
PHPExcel_db_to_Excel
<?php
header('Content-type: text-html charset=utf-8');
require_once __DIR__ . '/vendor/autoload.php';
require_once __DIR__ . '/conf.php';
require_once __DIR__ . '/class/timer.class.php';
require_once __DIR__ . '/class/Database.class.php';
require_once __DIR__ . '/class/Sql.class.php';
Timer::start();
php artisan make:auth
@spacebit-official
spacebit-official / PHPExcel_Excel_to_Db.php
Last active November 27, 2017 00:17
PHPExcel_Excel_to_Db
<?php
function readExelFile($filepath){
require_once __DIR__ . '/../classes/PHPExcel/PHPExcel.php'; //подключаем наш фреймворк
$ar=array(); // инициализируем массив
$inputFileType = PHPExcel_IOFactory::identify($filepath); // узнаем тип файла, excel может хранить файлы в разных форматах, xls, xlsx и другие
$objReader = PHPExcel_IOFactory::createReader($inputFileType); // создаем объект для чтения файла
$objPHPExcel = $objReader->load($filepath); // загружаем данные файла в объект
$ar = $objPHPExcel->getActiveSheet()->toArray(); // выгружаем данные из объекта в массив
return $ar; //возвращаем массив
<?php
//новый движок PHPNG этот движок практически такой как у facebook
//у facebook движок HHVM
// <=> == strcmp(); комбинированный оператор сравнения
declare(strict_types=1); // включение динамеческой типизации
function foo(int $int) {}
$test = $str ?? 'test';
<?php
function translit($str, $val = 'en') {
$translit = array(
'а' => 'a', 'б' => 'b', 'в' => 'v',
'г' => 'g', 'д' => 'd', 'е' => 'e',
'ё' => 'yo', 'ж' => 'zh', 'з' => 'z',