-1

I want to parse HTML elements properties to Array. in the example in 2 line have 2 objects:

<?php

    $str='<label>First name: <input type=text name=firstname /></label>\n<label>Last name: <input type=text name=lastname /></label>\n';
    $i=1;
    $start[1]="type=";
    $end[1]=" ";

    preg_match_all('/'.$start[$i].'(.*?)'.$end[1].'/i', $str, $item->type);

    var_dump($output);

?>

in this case the query should be $item->type[1][1] to resulting "TEXT" as input type. but i need something like this: $item[1]->type

The final result should be a PlainHTML2DrupalWebformImportableXML converter.

Thank You!

0

1 Answer 1

1

If you are parsing HTML, I suggest you use PHP Simple HTML DOM Parser: http://simplehtmldom.sourceforge.net/manual.htm

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.