Scris pe

Rusia vrea sa schimba procesoarele americane cu unele autohtone

Microchipurile americane Intel si AMD vor fi inlocuite cu unele authotone numite Baikal intr-un proiect care va costa milioane de dolari. Industria Rusiei si ministerul de comert vrea sa renunte la procesoarele facute un Statele Unite si este gata sa adopte procesoarele facute la ei in tara nmite Baikal. Procesoarele vor fi produse anul viitor...

Since Php 5.4, the /e modifier in preg_replace function has been deprecated and thus the code which uses this modifier should be modified or it will stop working. How can you do that? Simple. Let’s look on the source code of mPDF. We have the following:

$html = preg_replace(‘/\{DATE\s+(.*?)\}/e’,”date(‘\\1’)”,$html );

What this does is replacing for example {DATE d-m-y} with the PHP function of date(‘d-m-y’). We should modify this line as we can see it uses the /e modifier and it won’t work anymore on php 5.5. To replace it, we use the preg_replace_callback function like this:

$html = preg_replace_callback(‘/\{DATE\s+(.*?)\}/’,create_function(‘$matches’, ‘return date($matches[1]);’),$html );

Or even better using PHP 5.5 standards:

$html = preg_replace_callback(‘/\{DATE\s+(.*?)\}/’, function($matches) { return date($matches[1]); },$html );

What this does is that it creates a anonymus function and returns the date() function with the matches.

So, the alternative method to the /e modifier is to use the preg_replace_callback function in Php 5.5 or 5.4.

Iosua says:
Nu inteleg ce spune

Salutare, bine ati venit pe blogul lui Tata! Sa stiti ca aici nu o sa gasiti desene, v-am avertizat!

Iosua Pacurar

Scris pe

Office Fun – Din Ardeal

Office fun este o noua chestie ce vreau sa o fac aici pe blog, sa pun din cand in cand chestii amuzante pentru cei care lucreaza la birou ca sa isi mai descreteasca fruntile. Revoluție în domeniul fizicii! Cercetătorii ardeleni au inventat încetinitorul de particule! Gheo‘ si Ion erau pe cate-un deal cu oile: –...
Scris pe

Cum reactioneaza cainii la latratul uman

Rudi Rok este un actor care poate imita un latrat de caine aproape perfect. Urmareste-l mai jos sa vezi cum interactioneaza cu niste caini. Este amuzant sa le vezi reactia lor, cum pleaca de acolo sau incep sa latre si ei. Poate in curand cercetatorii britanici vor face un aparat care sa traduca latratul cainilor...
Copyright © 2024 toate drepturile
nu sunt
rezervate. Faceti ce vreti, e o tara libera.
Cred ca nu mai are rost sa zic, dar tema e facuta de mine cu Tailwind CSS. Gasesti codul sursa aici.
Inca folosesc WordpPess 🧡. Tema e insa custom Laravel 😎.