Giter VIP home page Giter VIP logo

mpdf's Introduction

mPDF is a PHP library which generates PDF files from UTF-8 encoded HTML.

It is based on FPDF and HTML2FPDF (see CREDITS), with a number of enhancements. mPDF was written by Ian Back and is released under the GNU GPL v2 licence.

Latest Stable Version Total Downloads License

⚠ If you are viewing this file on mPDF GitHub repository homepage or on Packagist, please note that the default repository branch is development which can differ from the last stable release.

Requirements

PHP versions and extensions

  • PHP >=5.6 <7.3.0 is supported for mPDF >= 7.0
  • PHP 7.3 is supported since mPDF v7.1.7
  • PHP 7.4 is supported since mPDF v8.0.4
  • PHP 8.0 is supported since mPDF v8.0.10
  • PHP 8.1 is supported as of mPDF v8.0.13
  • PHP 8.2 is supported as of mPDF v8.1.3
  • PHP 8.3 is supported as of mPDF v8.2.1

PHP mbstring and gd extensions have to be loaded.

Additional extensions may be required for some advanced features such as zlib for compression of output and embedded resources such as fonts, bcmath for generating barcodes or xml for character set conversion and SVG handling.

Known server caveats

mPDF has some problems with fetching external HTTP resources with single threaded servers such as php -S. A proper server such as nginx (php-fpm) or Apache is recommended.

Support us

Consider supporting development of mPDF with a donation of any value. Donation button can be found on the main page of the documentation.

Installation

Official installation method is via composer and its packagist package mpdf/mpdf.

$ composer require mpdf/mpdf

Usage

The simplest usage (since version 7.0) of the library would be as follows:

<?php

require_once __DIR__ . '/vendor/autoload.php';

$mpdf = new \Mpdf\Mpdf();
$mpdf->WriteHTML('<h1>Hello world!</h1>');
$mpdf->Output();

This will output the PDF inline to the browser as application/pdf Content-type.

Setup & Configuration

All configuration directives can be set by the $config parameter of the constructor.

It is recommended to set one's own temporary directory via tempDir configuration variable. The directory must have write permissions (mode 775 is recommended) for users using mPDF (typically cli, webserver, fpm).

Warning: mPDF will clean up old temporary files in the temporary directory. Choose a path dedicated to mPDF only.

<?php

$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/tmp']);

By default, the temporary directory will be inside vendor directory and will have write permissions from post_install composer script.

For more information about custom temporary directory see the note on Folder for temporary files in the section on Installation & Setup in the manual.

If you have problems, please read the section on troubleshooting in the manual.

About CSS support and development state

mPDF as a whole is a quite dated software. Nowadays, better alternatives are available, albeit not written in PHP.

Use mPDF if you cannot use non-PHP approach to generate PDF files or if you want to leverage some of the benefits of mPDF over browser approach – color handling, pre-print, barcodes support, headers and footers, page numbering, TOCs, etc. But beware that a HTML/CSS template tailored for mPDF might be necessary.

If you are looking for state of the art CSS support, mirroring existing HTML pages to PDF, use headless Chrome.

mPDF will still be updated to enhance some internal capabilities and to support newer versions of PHP, but better and/or newer CSS support will most likely not be implemented.

Online manual

Online manual is available at https://mpdf.github.io/.

General troubleshooting

For general questions or troubleshooting please use Discussions.

You can also use the mpdf tag at Stack Overflow as the StackOverflow user base is more likely to answer you in a timely manner.

Contributing

Before submitting issues and pull requests please read the CONTRIBUTING.md file.

Unit Testing

Unit testing for mPDF is done using PHPUnit.

To get started, run composer install from the command line while in the mPDF root directory (you'll need composer installed first).

To execute tests, run composer test from the command line while in the mPDF root directory.

Any assistance writing unit tests for mPDF is greatly appreciated. If you'd like to help, please note that any PHP file located in the /tests/ directory will be autoloaded when unit testing.

mpdf's People

Contributors

bmg-ruudv avatar chab avatar chrisb9 avatar danielhjames avatar dasc3er avatar derklaro avatar dundee avatar fglueck avatar finwe avatar jagdishkuma avatar jakejackson1 avatar janslabon avatar jayvdb avatar klap-in avatar kravcik avatar krzaczek avatar lucassouzavieira avatar machour avatar marinovdf avatar markvaughn avatar patromo avatar pdscopes avatar peterdevpl avatar rafaelgss avatar ram4nd avatar samuelecat avatar scottconnerly avatar silverfire avatar tomk avatar tomtomau avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpdf's Issues

div width carries over instead of resetting.

Repost from mPDF forum user TAlmasy:

Example code that displays problem:

<?php
$prob = '
<div style="width:100%;" id="ONEHUNDREDWIDTH">
<div style="float:right; width:70mm; height:30mm; background:rgba(0,0,0,0.5); font-size:15pt;" id="RIGHTFLOAT">right</div>
';

$letters = ['a','b','c','d','e'];
for($i=0;$i<4;$i++){
    $prob .= '
    <div style="float:left; " id="'.$bg[$i].'">
        <div style="float:left; background:rgba(255,0,0,0.5); height:20mm; width:30%;" id="LETTER '.$letters[$i].'1">'.$letters[$i].'1</div>
        <div style="float:left; background:rgba(255,0,0,0.5); height:20mm; width:49%;" id="LETTER '.$letters[$i].'1">'.$letters[$i].'2</div>
    </div>
    ';
}
$prob .= '</div>';

include_once($_SERVER['DOCUMENT_ROOT']."/mpdf60/mpdf.php");
$mpdf=new mPDF('utf-8',[100,30], 0, 'times', 0, 0, 0, 0, 0, 0);
$mpdf->WriteHTML($prob);
$mpdf->Output();
?>

Notice how when the second set of divs appears on the page it doesn't expand to the page width?

Here's a workaround I found (it can probably be modified a bit so it only effects nested floated divs).

On line 14701 add block from the second line to end:

            $this->OpenTag($tag,$attr,$a,$i);    // mPDF 6
            if( $this->blk[$this->blklvl]['NewPageStart'] == 'y'){
                $i -= (count($this->blk)+1)/2;
                $this->blklvl = 0;
                $temp = $this->blk[0];
                unset($this->blk);
                $this->blk[0] = $temp;
                continue;
            };

And on line 17182 add the $currblk['NewPageStart'] = 'y'; and return bit:

    if (isset($properties['HEIGHT'])) {
        $currblk['css_set_height'] = $this->ConvertSize($properties['HEIGHT'],($this->h - $this->tMargin - $this->bMargin),$this->FontSize,false);
        if (($currblk['css_set_height'] + $this->y) > $this->PageBreakTrigger && $this->y > $this->tMargin+5 && $currblk['css_set_height'] < ($this->h - ($this->tMargin + $this->bMargin))) {
            $currblk['NewPageStart'] = 'y';
            $this->AddPage($this->CurOrientation);
            return;            
        }
    }

6.0 > undefined offset (2x)

Using latest mPDF (6.0) is displaying 2 notices:
Undefined offset: 16 in mpdf.php on line 21162
This because $arrayaux[$i][16] does not exist.
And
Undefined offset: 1 in mpdf.php on line 21193
Nearly the same: $arrayaux[$i]

Disabling any error output will work, but cannot be the solution.

Code cleanup - Coding standard

Before all orher code enhancements, I would like to enforce a coding standard on the project.

PSR-2 may be a nice choice, of course with some exceptions to maintain backwards compatibility.

No place to define external directory for graph_cache

Currently paths for temoprary and ttffontdata directory can be defined so that they can be placed outside the library itself for security purpose. This is a nice feature.

However, the path for graph_cache folder is fixed and can not be changed to external directory.
Can this be added as a feature in the same way as the above two folders are defined as follows
define("_MPDF_TEMP_PATH", DIR.'/../permitted/mpdf/tmp/');
define("_MPDF_TTFONTDATAPATH", DIR.'/../permitted/mpdf/ttfontdata/');

Widow and orphan support (CSS property)

please allow to set, where to store temp data

currently you write into the following folders inside of the package:

  • tmp
  • ttffontdata
  • graph_cache

would be pretty nice to be able to define either these 3 pathes individually or via a prefix path, which will resolve like this:

  • PREFIX/tmp
  • PREFIX/ttffontdata
  • PREFIX/graph_cache

This way we can ensure, that we do not need to write into the folders of the package, which should be possible at all circumstances.

Coding standard - language constructs - parenthesis

Language constructs are provided by the language itself so they are NOT function.
Such include require exit echo print return... unless you need to bundle a long input/string.
So it's better to remove ALL Parenthesis from them.

WriteBarcode() does not support all documented characters

The function WriteBarcode() strips the hyphen character (-) although the documentation says it is supported for Code39 and some other types.

If someone can explain to me why this character is removed, i will try to help providing a bugfix.

Move mPDF to its own namespace

For version 7.0 I'd like to introduce mPDF namespace for all classes. So the main class would be \mPDF\mPDF, all other classes would be prefixed accordingly.

5.7.4 - config_cp.php not found

Warning: require_once(C:/www/index/config_cp.php): failed to open stream: No such file or directory in C:\www\index\mpdf.php on line 39

Fatal error: require_once(): Failed opening required 'C:/www/index/config_cp.php' (include_path='.;C:\program files\php\PEAR') in C:\www\index\mpdf.php on line 39

Via this http://mpdf1.com/manual/index.php?tid=106 link.

Problem with crop marks and custom footers

I have been trying to get PDF file with crop marks and custom headers on front matter and content pages. I have put all of my experiments (with code and output PDF files) here - https://github.com/booktype/mPDF-examples

My output files either have no visible page numbers or ToC is broken without page numbers for my chapters.

I am expecting to get this from the output:

  • PDF has visible crop marks
  • Front Matter (before and including ToC) not to show page numbers
  • ToC to show page numbers for my chapters
  • Content to show page number on each page

I will also post message to Forum (I applied for an account) and see if someone had similar issue.

License issue: GPL v2 vs. ASL 2.0

It's not really clear under which GPL version mPDF is released. On this page it seems like it is release under both. In the LICENSE.txt version 2 is declared. Somewhere in the source code only "GPL" without a version is used. So I guess it's version 2 atm.

Anyhow, mPDF includes code which is released under the "Apache Software License 2.0" (classes from FPDI) which is incompatible to GPL v2 while it is compatible to GPL v3.

This issue exists for several years now, but as I just updated the classes from FPDI (#16) I though it's time to move at least to GPL v3?

bootstrap not working

hi,

i am using mpdf in yii2. This is my controller code

public function actionPrint_death_certificate1()
    {

        $this->layout   =   'certificate';


        $html   =   $this->render('test');
        require_once(Yii::$app->basePath . "/../vendor/mpdf/mpdf/mpdf.php");
        $mpdf=new mPDF();
        $mpdf->WriteHTML($html);
        $mpdf->Output();

    }

my view

<div class="container">
    <div class="row">
        <div class="col-md-6">
        Heading1
        </div>
        <div class="col-md-6">
        Heading2
        </div>
    </div>
</div>

now i get a pdf with heading1 and heading2 in two different lines. Bootstrap is not working. Am i missing something?

return $this->render('test');

when i tried this one it is working and heading1 and heading2 is coming in one line. In pdf it is not working

Fieldset - Legend has wrong fonttype

When inside a frameset is a tag with any other font (like monotyp), in this case class="mono", the legend get the same font.
This is only if there is some content in the tag. If it is empty the font is arial (default/correct).

  <div class="grid-66 mobile-grid-100 tablet-grid-100">
        <fieldset class="sec">
        <legend>Karosserie-Prüfung</legend>
      <b style="margin-right: 10px;">Status</b> <span class="fakeinput mark_1">in Ordnung</span>
      <br><div class="fakeinput"><pre class="mono"></pre></div>
    </fieldset>
    <br>
    <fieldset class="sec">
    <legend>Wartung laut DSR</legend>
      <div>
          <b style="margin-right: 10px;">Status</b> <span class="fakeinput mark_1">in Ordnung</span>
          <br><div class="fakeinput">
           <pre class="mono">{I'm monotype by css. If I'm not empty the legend get my font}</pre></div>
      </div>
    </fieldset>
</div>

Convert all files to UTF-8

Converting is not that simple as some special characters would be owerwritten - a check and preferably a unit test would be in order. Changed characters can be seen in pull request #21

<tocpagebreak> could have an option for the number of columns in the Table of Contents

It saves paper to have two or more columns in the Table of Contents when there are hundreds of chapter names with short titles.

Currently, the HTML for the table of contents appears to switch columns off in the class tocontents (see lines 225-226 of https://github.com/mpdf/mpdf/blob/development/classes/tocontents.php):

    if ($this->mpdf->ColActive) {
        $this->mpdf->SetColumns(0);

The tag could have the parameters 'column-count', 'vAlign' and 'column-gap' to control the values nCols, vAlign and gap for SetColumns (see http://mpdf1.com/manual/index.php?tid=113 and http://mpdf1.com/manual/index.php?tid=139).

$list_item_marker

Undefined variable: list_item_marker.
Variable $list_item_marker seems to be uninitialized.
(mpdf.php v6.0 Line: 19446)
SOLUTION:
Line 19446 :

$objattr['text'] = $list_item_marker; 

have to be commented or deleted.

Multiple nth childs not displaying.

Repost from mPDF forum user TAlmasy:

<?php
$prob = '
<style>
tr:nth-child(odd) td:nth-child(2n+2){
    background: yellow;
}
</style>

<table>';

for($i=1;$i<=4;$i++){
    $prob .= '<tr>';
    for($j=1;$j<=10;$j++){
        $prob .= '<td>'.$j.'</td>';
    }
    $prob .= '</tr>';
}
$prob .= '</table>';

include_once($_SERVER['DOCUMENT_ROOT']."/mpdf60b/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($prob);
$mpdf->Output();
?>

This code will not parse the td section correctly.
This can be fixed by commenting out line 251 in the css manager.

$tg = preg_replace('/NTH-CHILD\(.*\)/', 'NTH-CHILD('.str_replace(' ','',$m[1]).')', $tg);

I'm not really even sure what this line is for. I can see why it is failing (the * is greedy and grabbing everything between the parenthesis), but for what purpose is it replacing the text?

Problem with config_fonts.php

I have imported mpdf class with composer (including it in composer.json) and I tried to use my own TrueType Fonts.
I know that I can modify config_fonts.php and copy my fonts to ttfonts directory, but when I tried to work with a repository (Here is where I needed composer.json) I couldn't find a solution to use my fonts.
I tried to solve this by the definition of the constants MPDF_SYSTEM_TTFONTS, MPDF_TTFONTPATHand MPDF_TTFONTDATAPATH but it didn't helped because my problem was config_fonts.php.
Then, I put this:

$pdf = new mPDF('utf-8','A4','','Foco',0,0,23,0,0,0,'');
$pdf->fontdata = array(
    "foco" => array(
        'R' => "Foco_Rg.ttf",
        'B' => "Foco_0.ttf",
        'I' => "Foco_Lt.ttf",
        ),
    );

But when I tried to export my pdf file I got this error:

mPDF Error - Font is not supported - dejavusanscondensed

I searched but I didn't found how to solve it.

Arabic characters not connected in a loop

Hi,

See the following php code:

<?php

require '../mpdf.php';

for ($index = 1; $index <= 5; $index++)
{
    $mpdf=new mPDF('ar-s','A4','','');
    $mpdf->SetDirectionality('rtl');
    $mpdf->WriteHTML('سؤال');
    $mpdf->Output('test'.$index.'.pdf','F');
}

?>

The first created PDF file is OK, but in the other files, the Arabic characters are not connected.

OK (PDF 1): سؤال
Not OK (PDF 2-5): س ؤال (without the space after س)

Feature: FPDI PDF 1.5+ Support

Gents, since it is clear the open source version of FDPI won't support the ability to read PDF 1.5+ in the near future I've been looking into the "hows" of developing an open source version the whole community can use (it involved a lot of laborious reading of the PDF spec).

I believe the current blockers are two-fold:

  1. The support of new filters introduced in PDF 1.5.

    ASCIIHexDecode - Already Support in FPDI
    ASCII85Decode - Already Support in FPDI
    LZWDecode - Already Support in FPDI
    FlateDecode - Need to Implement
    RunLengthDecode - Need to Implement
    CCITTFaxDecode - Not sure about this yet
    JBIG2Decode - Not sure about this yet
    DCTDecode - Not sure about this yet
    JPXDecode - Not sure about this yet
    Crypt - Not sure about this yet

    Assuming the licensing issue is resolved, we'll be able to borrow heavily from the TCPDF project which actually implements the FlateDecode and RunLengthDecode filters already. That makes that job a bit easier.

  2. FPDI currently only supports standard xref tables. PDF 1.6 introduced xref cross reference streams which will need to be handled correctly. Again, the good news is the TCPDF project also implements this correctly in the getXrefData / decodeXrefStream / decodeXref methods in their tcpdf_parser.php file.

There could be additional blockers preventing this feature being implemented but I won't know without some real-world testing.

This isn't currently a high priority, but I feel it's one of those must-have features the PHP PDF open-source community will greatly benefit from.

I'll be playing around with this possibility in my free time. If anyone would like to contribute it would be greatly appreciated.

Use static HTML for example files

Dynamic HTML (eg. random italics every 10-ish word in example14_page_numbers_ToC_Index_Bookmarks.php) makes comparing result files after codebase change rather difficult if not impossible.

Unit Testing

It would be good in the near future to start writing unit tests for mPDF and breaking down some of the methods into smaller, more manageable chunks. I had understood v6 was the last major release Ian was going to work on. If mPDF is to move forward as a community effort the first step would be to refractor the software. Writing unit tests would be stage 1 of this process.

Thoughts?

Deprecated: preg_replace()

Hi there, i use 5.7.4 version of mpdf and my php version is 5.6.12.
I use this code

$pdf->setHTMLFooter('{DATE j-m-Y}');

end get that error:

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in somefiles/_mpdf/mpdf.php on line 7333

Thanks.

Remove all side effects from mpdf.php

Separate all direct output from main mpdf class to conform with PSR-1.

  • Separate debug/stats ouptut to its own class (with injectable writer class)
  • Separate progressbar to its own class
  • Separate warnings (PDFA etc) or just throw an exception with link to error description online

Tags with 0 as value not displaying.

Repost from mPDF forum user TAlmasy:

When a tag is made with a 0 value inside it will not render.
This does NOT happen in 5.7, only in 6.0

<?php
$prob = 'hi<b>0</b><b>1</b>';

include_once($_SERVER['DOCUMENT_ROOT']."/mpdf60/mpdf.php");
$mpdf=new mPDF();
$mpdf->WriteHTML($prob);
$mpdf->Output();
?>

This can be fixed by modifying line 21646 and adding the && $arrayaux[$i][0]!=='0' bit.

    // Remove empty items // mPDF 6
    for($i=$array_size-1; $i > 0; $i--) {
        if (empty($arrayaux[$i][0]) && $arrayaux[$i][0]!=='0' && $arrayaux[$i][16]!=='0' && empty($arrayaux[$i][7])) {
            unset($arrayaux[$i]);
        }
    }

PHP 7 Deprecated contructor

PHP Deprecated Warning – yii\base\ErrorException
Methods with the same name as their class will not be constructors in a future version of PHP; mPDF has a deprecated constructor

image

Mpdf change timezone even if timezone is set

I made some step-by-step test, where is problem with timezone on production server.

Server setting timezone "Europe\Prague"
date_default_timezone_get(); //Europe/Prague

Framework (Nette) setting timezone "Europe\Prague"
date_default_timezone_get(); //Europe/Prague

Loading mPdf by autoload
date_default_timezone_get(); //Europe/London

Comment lanes:
//if(function_exists("date_default_timezone_set")) {
//if (ini_get("date.timezone")=="") { date_default_timezone_set("Europe/London"); }
//}
date_default_timezone_get(); //Europe/Prague

Determine minimum PHP version for next major version, and lifecycle

@finwe wrote: "I believe mPDF officially supports PHP 5.2, however it can be run on PHP 4 when not using many advanced features. In the first round of code cleanup, I would like to retain this compatibility." Source: #35 (comment)

@blueliquiddesigns wrote: "With this change it also would be good to decide on the minimum supported PHP version mPDF should support in the future. I'd recommend PHP5.3.2 which will allow us to take advantage of namespaces, autoloading, closures and SPL." Source:
#35 (comment)

@danielhjames wrote: " I suggest there would be one branch for fixes to 6.0 which could potentially be the basis of an official 6.1 release, with Ian's approval, as these changes should be relatively easy to review. There would be another branch for a future mPDF 7.0 release which was refactored, with all the improvements we would like to see." Source: #47 (comment)

PHP 5.4.x has reached end of life:
"Please note that according to the PHP version support timelines, PHP 5.4.45 is the last scheduled release of PHP 5.4 branch. There may be additional release if we discover important security issues that warrant it, otherwise this release will be the final one in the PHP 5.4 branch. If your PHP installation is based on PHP 5.4, it may be a good time to start making the plans for the upgrade to PHP 5.5 or PHP 5.6."
Source: http://php.net/archive/2015.php#id2015-09-04-4

The mPDF team should not spend additional time to support end-of-life versions of PHP. I propose that future major versions (ex.: mPDF 7) require a minimum of PHP 5.5, which offers significant performance gains:
https://thephp.cc/news/2013/06/php-5-5-out-of-the-box-bytecode-cache
And this will help with documented performance concerns:
http://mpdf1.com/manual/index.php?tid=266
http://mpdf1.com/manual/index.php?tid=408

Best regards,

M ;-)

Support for Font Awesome and Glyphicons by default (and perhaps other icon fonts)

mPDF 6.0 has over 85 megs (uncompressed) of data in the ttfonts directory (out of 108 Megs). This has the benefit that a large number of languages are supported out of the box.

BuiltWith reports that Font Awesome is used by 22% of websites:
http://trends.builtwith.com/widgets/fonts

Glyphicons are in Bootstrap, which has a huge presence as well:
http://trends.builtwith.com/docinfo/Twitter-Bootstrap
http://getbootstrap.com/components/#glyphicons

So they definitely should be handled somehow. And perhaps other popular open fonts should be included as well (ex.: Glyphicons)

Thanks!

Border Spacing prevents table from breaking between pages

With the border spacing property applied to my table it prevented the table from breaking the rows between pages. It would simply cutoff the table and continue printing other content on the following pages with the rest of the table nowhere to be found.

body classes are removed/ignored

My css fails because body classes are getting removed, here is a demo/bodge of the affected area.

mpdf.php

  if (preg_match('/<body([^>]*)>(.*?)<\/body>/ism',$html,$m) || preg_match('/<body([^>]*)>(.*)$/ism',$html,$m)) { 
-   $html = $m[2];
+   $html = '<div ' . $m[1] . '>' . $m[2] . '</div>';
  }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.