Mysql convert timestamp to date
SELECT DATE_FORMAT(FROM_UNIXTIME(yourfield), '%e %b %Y') FROM yourtable; |
SELECT DATE_FORMAT(FROM_UNIXTIME(yourfield), '%e %b %Y') FROM yourtable; |
Associative arrays in PHP = Javascript Objects written as name value pairs = Hash maps in Java
<?php $x = 5; for($i=0; $i<10; $i++) { if($i % $x == 0) { echo 'yes'; } } |
Result: yes yes
Explanation: 5 % 5 has remainder 0 (fully divided), 10 % 5 has remainder 0 (fully divided)
head -n 1 upload_images.csv > header.csv; tail -n +2 upload_images.csv | split --numeric-suffixes=1 --additional-suffix=.csv -l 320 - --filter='sh -c "{ head -n1 header.csv; cat; } > $FILE"' |
split filename.csv --numeric-suffixes=1 --additional-suffix=.csv -l 50 |
Result: 50 files named as x{number}.csv
echo preg_replace("/[\W]/u", "", $str); |
UCS-2 is old encoding standard. It uses fixed size per encoded character and therefore is not compatible with ASCII.
UTF-8 is newer standard. It uses dynamic size between 8 – 32 bits per encoded character and is compatible with ASCII.
Я так понял что UCS-2 ещё называют UNICODE т.к. каждый символ это полные 2 байта тогда как UTF-8 называют просто UTF-8 изза того что размер используемых байтов меняется динамически взависимости от кодируемого символа.
But UCS-2 is used when sending SMS text message to mobile network, so if for single English SMS message 140 chars are used, for single Russian SMS message it is 70.
If you want to send web text as SMS to mobile phone do convert from UTF-8 to UCS-2 and then send.
For example, text here is stored in UTF-8 so I have to first convert it to UNICODE and then convert to URLencoded format. Then to send it via kannel we use charset=UCS-2
$in_msg = "проверим-ка-кодировку"; print urlencode(iconv('utf-8', 'ucs-2', $in_msg)); |
if(preg_match('/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/',$datetime)) { echo "correct"; } |
Yes.
Independently from the platform PHP is running on, the scripts are compiled into the same bytecode and run by the Zend Engine.
The difference from Java is that this compiled code is usually not stored into separate files and the scripts are re-compiled on each execution (however, see opcode caches).
Another important difference between the Zend Engine and a typical JVM is in the way they execute bytecodes:
The Zend Engine executes (interprets) the compiled bytecodes directly. (At least that’s what I think happens.)
A JVM will normally use a JIT compiler to compile bytecodes to native instructions, and then execute the native instructions.
Actually, JVM behaviour is more complicated than this. JVMs don’t always compile to native code, and when they do, they typically delay JIT compilation until they figure it is worth doing. Prior to that, they execute the bytecodes directly.
1. Create .gitattributes in repo’s main directory
2. Add the following line to it
*.css linguist-language=PHP |
3. Change css extension to right extension that causes the problem, for example to *.twig
If you already have Laravel move to Step 2
Step 1. Get Laravel
composer create-project --prefer-dist laravel/laravel . |
Step 2. Create following folder structure:
mkdir -p packages/aghayevi/modulename/src |
Step 3. Do the following
cd packages/aghayev/modulename composer init This command will guide you through creating your composer.json config. Package name (<vendor>/<name>) [root/modulename]: aghayevi/modulename Description []: My package for Laravel 5.6 Author [Imran Aghayev <imran.aghayev@hotmail.co.uk.co.uk>, n to skip]: n Minimum Stability []: dev Package Type []: License []: Apache License 2.0 Define your dependencies. Would you like to define your dependencies (require) interactively [yes]? no Would you like to define your dev dependencies (require-dev) interactively [yes]? no { "name": "aghayevi/modulename", "description": "My package for for Laravel 5.6", "license": "Apache License 2.0", "authors": [ { "name": "Imran Aghayev", "email": "imran.aghayev@hotmail.co.uk" } ], "minimum-stability": "dev", "require": {} } Do you confirm generation [yes]? y |
Step 4. Add package to laravel’s composer.json PSR-4 autoload section
cd ../.. ... "autoload": { "classmap": [ "database/seeds", "database/factories" ], "psr-4": { "App\\": "app/", "Aghayevi\\Modulename\\": "packages/aghayevi/modulename/src" } ... |
Step 5. Do composer dump-autoload to regenerate autoloading classes