-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!

eapo
  • 1,053
  • 1
  • 19
  • 40

1 Answers1

1

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

gwinh
  • 343
  • 6
  • 12