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 4 of 4

Thread: line numbers

  1. #1
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts

    line numbers

    I know there was someting on php.net about line numbers...
    It was an example in the functions. I was searching and I saw it and didnt really care because that was not what I was looking for. Now I am, but I cant find it again. Does anyone have any ideas? What I want is the source with line numbers...




    Thanks,
    ILLINI
    Why not thank me?

    http://adamsworld.name

  • #2
    Senior Coder
    Join Date
    Apr 2005
    Location
    Colorado, United States
    Posts
    1,208
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Line numbers? Just explode the text by \n and foreach the array.

    PHP Code:
    $text 'Foo
    Bar
    Is
    Bar
    Foo'
    ;
    $text_array explode("\n"$text);
    foreach (
    $text_array as $key => $line) {
         echo 
    'Line ' $key ': ' $line '<br />' "\n";

    "$question = ( to() ) ? be() : ~be();"

  • #3
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Would there be an easy way to just plug a filename in there instead of copy and pasteing?



    ILLINI
    Why not thank me?

    http://adamsworld.name

  • #4
    Regular Coder GO ILLINI's Avatar
    Join Date
    Jun 2005
    Location
    USA
    Posts
    634
    Thanks
    0
    Thanked 7 Times in 7 Posts
    Why not thank me?

    http://adamsworld.name


  •  

    Posting Permissions

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