473,396 Members | 2,033 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

array_push

158 100+
Ok what i need to do is ping somthing with a function i have and push the results with the ip as the key value in the array. heres my code so far i know it doesnt work but that is the main concept.

Expand|Select|Wrap|Line Numbers
  1.     $client2 = '10.0.0.129';
  2.       $pingResults = array();
  3.       $client1s = get_c1s($client2);
  4.  
  5.       array_push ( $pingResults , "$client2" => ping ( $client2 ) ); 
  6.  
  7.  
  8.       foreach ( $client1s as $node )
  9.        {        
  10.           array_push ( $pingResults , "$node" => ping ( $node ) );   
  11.        }
  12.  
Sep 20 '07 #1
2 1843
kardon33
158 100+
I got it working I was just thinking to hard.

Thers my solution.
Expand|Select|Wrap|Line Numbers
  1.   foreach ( get_c2s() as $client2 )
  2.     {
  3.       $pingResults = array();
  4.       $client1s = get_c1s($client2);
  5.  
  6.       $pingResults[$client2] = ping ($client2);
  7.       foreach ( $client1s as $node )
  8.        {        
  9.           $pingResults[$node] = ping ($node);
  10.        }
  11. }
  12.  
Sep 20 '07 #2
pbmods
5,821 Expert 4TB
Heya, Kardon.

Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
Sep 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Sandman | last post by:
Hello I have been trying to wrap my head arouns this, but I can't seem to get it to work the way I want it to. Could someone helpful please tell me how I get this: <function>...
4
by: Paul | last post by:
Hi, This is probably a no-brainer, but I could do with some help here. I have some code which looks like this $event = array("Date"=>array(), "Time"=>array(), "Venue"=>array(),...
6
by: chriscross | last post by:
I am trying to make three php pages: one showing the list of categories another showing a lost of the products of the category selected in the first page and the second showing the product...
0
by: grace01 | last post by:
Hello, My php program cannot display result correctly. After run array_push($y_options,$tmp_yr), $y_options doesn't show 2005, 2006, 2007, 2008, 2009. $y_options only show 2009, 2009, 2009, 2009,...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.