Jump to content

if rule (and yes, im new)


kennethamby
Go to solution Solved by Barand,

Recommended Posts

Hello,

 

First of: I have not been working with PHP for 5 years, and suddently decided: But I miss it. So startet working on a new site, where some of the code has allreade been done, but i do not work like he would like it to. So I am taking over, and my first real problem is this:

I have this value:
<?php echo gethostbyname($server_data['ip']) . ":" . $server_data['port']; ?>
And it works fine. 

But! (and not in the ass kind of way) :)

There are a port i dont need it to show. So i need to modifide it so if the port number is 1234 its no shown at all. 

 

I was thinking something like this:

 

<?php echo gethostbyname($server_data['ip']) . ":" . $server_data['port'] if 'port' = 1234 return null; ?> 

 

The above do not work (and im sure its my fault, but i cannot find the right way to do this)!

 

Help ? :)

Regards, 
Kenneth

Link to comment
Share on other sites

I cant test that for the next hour, but will that not return the total of 'null' (meaning: will that code not remove both the IP and the Port?)

 

atm is shows: serverIP and serverPort. (ex: 1.2.3.4:1000) and that is OK. 
but only one port should not be displayed. (the 1234 port)

 

So if a server has the adresse: 1.2.3.4:1000 it shoud display the ip and the port.

But if a server has the adresse: 1.2.3.4:1234 it shoud only display the ip and not the port
 

again: I cant test the script for the next hour, but thank you so mutch for your help! 

 

Regards Kenneth
 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.