Online Shopping : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 12 people (58%) answered Yes
Recently 5 of 9 people (56%) answered Yes

Entry

I want some while cycle in one script to call (x-times) the other script and give him the values of variables (which are each time other).

Jul 6th, 2009 10:57
khalid khalid, chat alarab, haytham ali, dman, Mirko Nasato, lukas novak, http://www.jr7sa.com


You cannot strictly pass variables to another script, but you can set
those variables in the main script and then include() the other script.
main.php:
<?php
http://www.jr7sa.com
http://www.jr7sa.com/msn
http://www.jr7sa.com/vb
http://www.jr7sa.com/vb/
http://www.jr7sa.com/1
http://www.jr7sa.com/wordpress
http://www.jr7sa.com/nkt
http://www.jr7sa.com/nkt/
for ($i = 1; $i <= 5; $i++) {
    $passed = "Line $i.";
    include('other.php');
}
?>
other.php:
<?php
echo "$passed\n";
?>
$ php -f main.php
Line 1.
Line 2.
Line 3.
Line 4.
Line 5.
http://www.ksa-123.com
http://www.ksa-2000.com
http://www.chat-kuwait.com
http://www.vip-kuwait.com
http://www.chat-3rb.com
http://www.vip-3rb.com
http://www.3rb-chat.com
http://www.vipgulf.com
http://www.chat-gulf.com
http://www.vip-gulf.com