Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    HG3
    HG3 is offline
    New Coder
    Join Date
    Sep 2011
    Location
    BRAZIL
    Posts
    23
    Thanks
    7
    Thanked 0 Times in 0 Posts

    read line by line in the textarea

    Hello my brothers, can you guys give me some help here
    My script searches the array of numbers in the text and sets the last found.

    can not check several at the same time of textarea.

    PHP Code:
    <form id="form1" name="form2" method="post" action="">
       <label>
       <textarea name="text" cols="60" rows="10"></textarea>
       </label>
       <input type="submit" name="submit" value="TEST" />
    </form>
    <?php
    if(isset($_POST['text'])&&($_POST['text'] != "")){

    $text explode("\n"$_POST['text']);

    for(
    $i=0;$i count($text);$i++){
           
    $num $text[$i];
           
    $search = array ('00','01','02','03'); //search numbers in the text 
    $p null;
    $o = -1;
    $l strlen$num );

            foreach ( 
    $search as $i ) {
            
    $c strrpos$num $i ); //Search by last

            
    if ( $c !== false && $c $o ) {
                    
    $p $i;
                    
    $o $c;

                    if ( 
    $c strlen$i ) == $l ) {
                    break;
                    }
            }
    }

    if ( 
    $o != -) { // last number set no text
    $result $p;
      }
     }
    }
    echo 
    $result;
    ?>
    can help verify several at the same time?

  • #2
    HG3
    HG3 is offline
    New Coder
    Join Date
    Sep 2011
    Location
    BRAZIL
    Posts
    23
    Thanks
    7
    Thanked 0 Times in 0 Posts
    got it solve.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •