Skip to content

Commit

Permalink
iputils anonymize do not use named params
Browse files Browse the repository at this point in the history
  • Loading branch information
MrYamous authored Dec 3, 2024
1 parent 7f6e80b commit ba60ee2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions components/http_foundation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -362,16 +362,18 @@ analysis purposes. Use the ``anonymize()`` method from the
$anonymousIpv6 = IpUtils::anonymize($ipv6);
// $anonymousIpv6 = '2a01:198:603:10::'

If you need even more anonymization, you can use the second and third parameters
of the ``anonymize()`` method to specify the number of bytes that should be
If you need even more anonymization, you can use a second and third parameters
to the ``anonymize()`` method to specify the number of bytes that should be
anonymized depending on the IP address format::

$ipv4 = '123.234.235.236';
$anonymousIpv4 = IpUtils::anonymize($ipv4, v4Bytes: 3);
$anonymousIpv4 = IpUtils::anonymize($ipv4, 3);
// $anonymousIpv4 = '123.0.0.0'

$ipv6 = '2a01:198:603:10:396e:4789:8e99:890f';
$anonymousIpv6 = IpUtils::anonymize($ipv6, v6Bytes: 10);
// (you must define the second argument (bytes to anonymize in IPv4 addresses)
// even when you are only anonymizing IPv6 addresses)
$anonymousIpv6 = IpUtils::anonymize($ipv6, 3, 10);
// $anonymousIpv6 = '2a01:198:603::'

.. versionadded:: 7.2
Expand Down

0 comments on commit ba60ee2

Please sign in to comment.