Jump to content

Xname

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Xname's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. HI...I hope u r all fine. I am using nested function ih php. this is not working.Here is the code. <?php $array = array('a','b','c'); big_func($array); function big_func($arr) { function func1($arr) { foreach($arr as $list1){ echo $list1.'<br />'; } function func2($arr) { foreach($arr as $list2){ echo '<b>'.$list2.'</b><br />'; } } function func3(){ $arra = array('d','e','f'); func1($arra); } } } ?> This is not working.What is the problem with this code? please help me .....thanks........
  2. Hi,Dear Frnds...........................I Hope U r all fine. I am using php.Here is the problem in the Return array from function. This is the code. <?php $store = array(); $test = get_my_links(); print_r($store); function get_my_links() { $my_array = array('e','f','g'); foreach($my_array as $key=> $list) { $store[] = $list; } return $store; } ?> Suppose the array is maked dynamically. please help me..THANKS...
  3. Sorry,Psycho.I can not show You this code.Security reason. If not any method to make a 2-dem array in unique. Please tell me "NO" or "YES".
  4. Hi,...........I Hope u r all fine. I know this is 2-dimensional array. But array always built dynamically and I am not able to make it a simple array. Can here is not any code to make it unique. If not, Then how can I changed 2-demensional array in a simple array.
  5. Hi,Dear Frnd...........I Hope u r all fine. I am using php array_unique function.Here is the problem in this function. This is the code. <?php $frnd1 = array( 0=> 'arfan', 1=> 'haider', 2=> array( 0=> 'azeem', 1=> 'jeme', ), 3=> array( 0=> 'haider', 1=> 'one' ) ); // please do not change the above code. // You can only change below code. print_r($frnd1); echo '<hr />'; print_r(array_unique($frnd1)); ?> This work fine,But when I am used array_unique then it does not work. When I am used array_unique.It ignore the [3]=>Array. As you can see in my array,Here is two time name "haider". I want to do that in this array all same names are convert into one unique name. In this array I want to ignore the "haider" name bcs it is two time.How can I do that. Remmber :: This example is very simple.Bcs u can understand it easily.Suppose if it is dynamically changed array then what i did do to make it unique.
  6. Hi,Dear frnds...................I Hope u r all fine. I solved this problem by himself. How to convert the foreach loop in array using php? first of all make two array. sxecute the foreach loop and creat a if statment inside the foreach loop.After that merge these two arrays and get results. <?php $array1 = array(); $array2 = array(); $something = array('execute1','execute2'); foreach($something as $key=> $list){ // if execute1 get some result // if execute2 get some result if($key == 0){ $array1[] = $ur_result; } else{ $array2[] = $ur_result; } } $result_array = array_merge($array1,$array2); print_r($result_array); ?>
  7. Hi,Frnds....I hope u are all fine. "Drummin" Your answer is good but in your code here is a problem You can write this code only for seven links.Suppose if it is not seven it is seven hundred or may be seven thousand. And if I can not know what are the length of the links. Then I can not be able to write this code for all these links. Please tell me about this problem. ......................THANKS..............................................
  8. Hi, Frnds..I hope u r all fine. First of all telling u that i can not use the array_merg().Because i had some resaon due I can not use the array_merg(); Friend "cyberRobort" I had not this question which u answered.Please focus on the question. I said,$something is equal to url1 and url2.This is not thing where is my result. Please focus on this. <?php $something = array('google.com','php.net'); $result_array = array(); foreach($something as $links) { $url_links = get_links_from_site($links); // ignore this.This is only supposed code which get links. //here is the code which get the links from site // suppose this links is link1 and link2.ok // this result comes when it is execute first time // my mean when $links is equal to 'google.com'; //here is the code which get the links from site // suppose this links is link3 and link4.ok // this result comes when it is execute second time // my mean when $links is equal to php.net'; $result_array = $url_links; } print_r($result_array); ?> Its ut put is Link3 and link4. But i want to get the result Link1 , Link2 , Link3 and Link4. Please focus that my result is not 'goole.com' and 'php.net'. this is the links where I is my result. I define the problem more.ok <?php $something = array('google.com','php.net'); $result_array = array(); foreach($something as $links) { $url_links = get_links_from_site($links); // ignore this.This is only supposed code which get links. //here is the code which get the links from site // suppose this links is link1 and link2.ok // this result comes when it is execute first time // my mean when $links is equal to 'google.com'; //here is the code which get the links from site // suppose this links is link3 and link4.ok // this result comes when it is execute second time // my mean when $links is equal to php.net'; $result_array = $url_links; print_r($result_array); } ?> When u execute the $result_arrry in foreach loop then it gets the result link1 , link2 , link3 and link4. But when it is execute out side the foreach loop then it gets the result link3 and link4. This is the problem, I want to get the result link1 , link2 , link3 and link4. when it is result_array execute outside the foreach loop. I think u can now understand this problem. please help me ................thanks.........
  9. something is not equal to $something = array('A,B,C and D','E,F,G and H'); In the above code $something is any array.Which execute only foreach loop. Ok lets Define it more. $result_array = array(); $something = array('url1','url2'); foreach($something as $links) { //suppose here is code which get the links from url1 and url2 $url_links = get_url_links($links); //do not worried about this this is only suppose code // which get the links of the website // when it is executed first time it gets the links from "url1" // i.e www.google.com and www.facebook.com // when it is executed second time it get the links from "url2" // i.e www.wikipedia.com and www.phpfreaks.com. $result_array[] = $urls_links } print_r($result_array); // it can return only those links which can be taken from "url2" // i.e www.wikipedia.com and www.phpfreaks.com. But I want to get the all links i.e www.google.com and www.facebook.com...www.wikipedia.com and www.phpfreaks.com.
  10. Hi...Dear frnds.I hope u are all fine. I am using php.Here is a problem in php code. I want to get the foreach loop in the form of array. Example: suppose here is foreach loop. which execute for two times. $any_array = array(); foreach($something as $anything) { //when it is execute first time.return. A,B,C and D. //when it is executed for second time.return. E,F,G and H. $any_array[] = $anything; } print_r($any_array); // it print out only " E,F,G and H. " // but I want to get the both. " A,B,C and D... E,F,G and H. " How can I get it.Please tell me about this. Here is a simple example.it is not for execute for two time and are bigger then A,B,C and D... E,F,G and H. what can i do for get it. ......................THANKS..........…
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.