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 3 of 3
  1. #1
    New Coder
    Join Date
    Dec 2010
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts

    extract data from Function

    hello

    I want to get loop numbers and hyperlinks from other included file function
    how to call function that gives me all 1-10 numbers and hyperlinks thanks

    Code:
    include('linksandid.php');
     idlink(); here i want get all numbers and hyperlinks separately  
    ?>

    linksandid.php:
    Code:
    <?php
    function idlink() {
    		for($i =1; $i <= 10; $i ++) {
    		$links = "<a href=\"http://localhost\123.php?page=$i\"> $i</a> ";
    		}
    ?>

  • #2
    Regular Coder adarshakb's Avatar
    Join Date
    Jun 2009
    Location
    Silicon valley of india
    Posts
    247
    Thanks
    11
    Thanked 1 Time in 1 Post
    linksandid.php:
    PHP Code:
    <?php
    function idlink() {
                           
    $links=array();
            for(
    $i =1$i <= 10$i ++) {
            
    $links[$i] = "<a href=\"http://localhost\123.php?page=$i\"> $i</a> ";
            }
                       return 
    $links;
    ?>
    PHP Code:
    include('linksandid.php');
     
    $links_returned idlink(); here i want get all numbers and hyperlinks separately  
    foreach($links_returned => $i as $links)
    {
    //your codes
    }
    ?> 
    Two things are infinite: the universe and human stupidity; and I'm not sure about the universe.

    Albert Einstein
    -----------------------------------------------------
    My Blog songs

  • #3
    New Coder
    Join Date
    Dec 2010
    Posts
    36
    Thanks
    1
    Thanked 0 Times in 0 Posts
    getting error

    Parse error: syntax error, unexpected T_DOUBLE_ARROW in


  •  

    Posting Permissions

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