Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

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!

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
    
thank you. this is really a great app! –  eaposztrof Jun 3 '13 at 21:46
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.