Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-24-2010, 10:45 AM   PM User | #1
simzam
New Coder

 
Join Date: Dec 2010
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
simzam is an unknown quantity at this point
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> ";
		}
?>
simzam is offline   Reply With Quote
Old 12-24-2010, 11:31 AM   PM User | #2
adarshakb
Regular Coder

 
adarshakb's Avatar
 
Join Date: Jun 2009
Location: Silicon valley of india
Posts: 247
Thanks: 11
Thanked 1 Time in 1 Post
adarshakb has a little shameless behaviour in the past
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
adarshakb is offline   Reply With Quote
Old 12-24-2010, 11:53 AM   PM User | #3
simzam
New Coder

 
Join Date: Dec 2010
Posts: 36
Thanks: 1
Thanked 0 Times in 0 Posts
simzam is an unknown quantity at this point
getting error

Parse error: syntax error, unexpected T_DOUBLE_ARROW in
simzam is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:25 PM.


Advertisement
Log in to turn off these ads.