API15

JLDAP/ipToNetAddress: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 54: Line 54:


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=ipToNetAddress
  category=ipToNetAddress
  category=JLDAP
  category=JLDAP
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*

Latest revision as of 00:55, 25 March 2017

Description

Converts a dot notation IP address to net address (e.g. for Netware, etc)

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

ipToNetAddress($ip)
Parameter Name Default Value Description
$ip IP Address (e.g. xxx.xxx.xxx.xxx)

Returns

string Net address public

Defined in

libraries/joomla/client/ldap.php

Importing

jimport( 'joomla.client.ldap' );

Source Body

function ipToNetAddress($ip)
{
        $parts = explode('.', $ip);
        $address = '1#';

        foreach ($parts as $int) {
                $tmp = dechex($int);
                if (strlen($tmp) != 2) {
                        $tmp = '0' . $tmp;
                }
                $address .= '\\' . $tmp;
        }
        return $address;
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

Code Examples