Author: Pooja Kotwani

  • Ds\Queue Functions

    Basic Ds\Queue Functions

    allocate()
    Description: Allocate memory for a Queue instance.
    Example:

    $queue = new \Ds\Queue();
    $queue->allocate(10);
    echo $queue->capacity();
    // Output: 10

    capacity()
    Description: Check the current capacity of a Queue instance.
    Example:

    $queue = new \Ds\Queue();
    $queue->allocate(5);
    echo $queue->capacity();
    // Output: 5

    clear()
    Description: Clear all elements from a Queue instance.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $queue->clear();
    print_r($queue);
    // Output: Ds\Queue Object ( )

    copy()
    Description: Create a shallow copy of a particular Queue instance.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $copiedQueue = $queue->copy();
    print_r($copiedQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 )

    copy()
    Description: Create a shallow copy of a particular Queue instance.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $copiedQueue = $queue->copy();
    print_r($copiedQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 )

    count()
    Description: Get the count of elements present in a Queue instance.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo $queue->count();
    // Output: 3

    isEmpty()
    Description: Check whether a particular Queue instance is empty or not.
    Example:

    $queue = new \Ds\Queue();
    echo $queue->isEmpty();
    // Output: 1 (true)

    peek()
    Description: Get the value present at the front of a Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo $queue->peek();
    // Output: 1

    pop()
    Description: Remove and return the value present at the front of the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo $queue->pop();
    // Output: 1

    push()
    Description: Insert values into the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2]);
    $queue->push(3, 4);
    print_r($queue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

    toArray()
    Description: Convert a Queue into an array.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    print_r($queue->toArray());
    // Output: Array ( [0] => 1 [1] => 2 [2] => 3 )

    reverse() (Custom Implementation)
    Description: Reverse the order of elements in the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $reversedQueue = new \Ds\Queue(array_reverse($queue->toArray()));
    print_r($reversedQueue);
    // Output: Ds\Queue Object ( [0] => 3 [1] => 2 [2] => 1 )

    merge() (Custom Implementation)
    Description: Merge the current Queue with another iterable and return a new Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $mergedQueue = new \Ds\Queue([...$queue->toArray(), ...[4, 5]]);
    print_r($mergedQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

    filter() (Custom Implementation)
    Description: Filter elements in the Queue based on a condition.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4]);
    $filteredQueue = new \Ds\Queue(array_filter($queue->toArray(), fn($value) => $value % 2 === 0));
    print_r($filteredQueue);
    // Output: Ds\Queue Object ( [0] => 2 [1] => 4 )

    find() (Custom Implementation)
    Description: Find a specific element in the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4]);
    $index = array_search(3, $queue->toArray());
    echo $index !== false ? "Found at index $index" : "Not found";
    // Output: Found at index 2

    rotate() (Custom Implementation)
    Description: Rotate the Queue by moving the first element to the end.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $array = $queue->toArray();
    array_push($array, array_shift($array));
    $rotatedQueue = new \Ds\Queue($array);
    print_r($rotatedQueue);
    // Output: Ds\Queue Object ( [0] => 2 [1] => 3 [2] => 1 )

    sum() (Custom Implementation)
    Description: Calculate the sum of all elements in the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo array_sum($queue->toArray());
    // Output: 6

    merge()
    Description: Merges another set or array into the current set.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo array_sum($queue->toArray());
    // Output: 6

    product() (Custom Implementation)
    Description: Calculate the product of all elements in the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    echo array_product($queue->toArray());
    // Output: 6

    chunk() (Custom Implementation)
    Description: Split the Queue into chunks of a specified size.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4, 5]);
    $chunks = array_chunk($queue->toArray(), 2);
    foreach ($chunks as $chunk) {
        print_r(new \Ds\Queue($chunk));
    }
    // Output:
    // Ds\Queue Object ( [0] => 1 [1] => 2 )
    // Ds\Queue Object ( [0] => 3 [1] => 4 )
    // Ds\Queue Object ( [0] => 5 )

    flatten() (Custom Implementation)
    Description: Flatten a multi-dimensional Queue into a single-level Queue.
    Example:

    $queue = new \Ds\Queue([[1, 2], [3, 4], 5]);
    $flattenedQueue = new \Ds\Queue(array_merge(...$queue->toArray()));
    print_r($flattenedQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

    ksort() (Custom Implementation)
    Description: Sort the elements of the Queue in ascending order.
    Example:

    $queue = new \Ds\Queue([3, 1, 4, 2]);
    $sortedQueue = new \Ds\Queue(sort($queue->toArray()) ? $queue->toArray() : []);
    print_r($sortedQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

    unique() (Custom Implementation)
    Description: Remove duplicate elements from the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 2, 3, 4, 4]);
    $uniqueQueue = new \Ds\Queue(array_unique($queue->toArray()));
    print_r($uniqueQueue);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

    shuffle() (Custom Implementation)
    Description: Randomly shuffle the elements of the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4]);
    $array = $queue->toArray();
    shuffle($array);
    $shuffledQueue = new \Ds\Queue($array);
    print_r($shuffledQueue);
    // Output: Ds\Queue Object ( [0] => 3 [1] => 1 [2] => 4 [3] => 2 ) // (order may vary)

    intersect() (Custom Implementation)
    Description: Find the intersection of elements between two Queue instances.
    Example:

    $queue1 = new \Ds\Queue([1, 2, 3, 4]);
    $queue2 = new \Ds\Queue([3, 4, 5, 6]);
    $intersection = new \Ds\Queue(array_intersect($queue1->toArray(), $queue2->toArray()));
    print_r($intersection);
    // Output: Ds\Queue Object ( [0] => 3 [1] => 4 )

    diff() (Custom Implementation)
    Description: Find the difference between two Queue instances.
    Example:

    $queue1 = new \Ds\Queue([1, 2, 3, 4]);
    $queue2 = new \Ds\Queue([3, 4, 5, 6]);
    $difference = new \Ds\Queue(array_diff($queue1->toArray(), $queue2->toArray()));
    print_r($difference);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 )

    union() (Custom Implementation)
    Description: Combine elements from two Queue instances, removing duplicates.
    Example:

    $queue1 = new \Ds\Queue([1, 2, 3]);
    $queue2 = new \Ds\Queue([3, 4, 5]);
    $union = new \Ds\Queue(array_unique(array_merge($queue1->toArray(), $queue2->toArray())));
    print_r($union);
    // Output: Ds\Queue Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

    slice() (Custom Implementation)
    Description: Extract a portion of the Queue based on the given offset and length.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4, 5]);
    $slicedQueue = new \Ds\Queue(array_slice($queue->toArray(), 1, 3));
    print_r($slicedQueue);
    // Output: Ds\Queue Object ( [0] => 2 [1] => 3 [2] => 4 )

    partition() (Custom Implementation)
    Description: Partition the Queue into two based on a condition.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4, 5]);
    $even = new \Ds\Queue(array_filter($queue->toArray(), fn($value) => $value % 2 === 0));
    $odd = new \Ds\Queue(array_filter($queue->toArray(), fn($value) => $value % 2 !== 0));
    print_r($even);
    print_r($odd);
    // Output:
    // Ds\Queue Object ( [0] => 2 [1] => 4 )
    // Ds\Queue Object ( [0] => 1 [1] => 3 [2] => 5 )

    partition() (Custom Implementation)
    Description: Partition the Queue into two based on a condition.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4, 5]);
    $even = new \Ds\Queue(array_filter($queue->toArray(), fn($value) => $value % 2 === 0));
    $odd = new \Ds\Queue(array_filter($queue->toArray(), fn($value) => $value % 2 !== 0));
    print_r($even);
    print_r($odd);
    // Output:
    // Ds\Queue Object ( [0] => 2 [1] => 4 )
    // Ds\Queue Object ( [0] => 1 [1] => 3 [2] => 5 )

    reverseEach() (Custom Implementation)
    Description: Reverse the elements of a Queue and process each one.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4]);
    $reversedQueue = array_reverse($queue->toArray());
    foreach ($reversedQueue as $element) {
        echo $element . " ";
    }
    // Output: 4 3 2 1

    reduce() (Custom Implementation)
    Description: Reduce the Queue to a single value by applying a callback function.
    Example:

    $queue = new \Ds\Queue([1, 2, 3, 4]);
    $result = array_reduce($queue->toArray(), fn($carry, $item) => $carry + $item, 0);
    echo $result;
    // Output: 10

    map() (Custom Implementation)
    Description: Apply a transformation function to each element of the Queue.
    Example:

    $queue = new \Ds\Queue([1, 2, 3]);
    $mappedQueue = new \Ds\Queue(array_map(fn($value) => $value * 2, $queue->toArray()));
    print_r($mappedQueue);
    // Output: Ds\Queue Object ( [0] => 2 [1] => 4 [2] => 6 )
  • Basic Ds\Stack Functions

    Basic Ds\Stack Functions

    clear()
    Description: Removes all elements from a Stack and clears it.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $stack->clear();
    print_r($stack);
    // Output: Ds\Stack Object ()

    copy()
    Description: Creates a shallow copy of the original stack and returns the copied stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $copiedStack = $stack->copy();
    print_r($copiedStack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 )

    isEmpty()
    Description: Checks whether a Stack is empty or not.
    Example:

    $stack = new \Ds\Stack();
    echo $stack->isEmpty();
    // Output: 1 (true)

    clear()
    Description: Removes all values from the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->clear();
    print_r($set);
    // Output: Ds\Set Object ()

    peek()
    Description: Gets the element present at the top of the Stack instance without removing it.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo $stack->peek();
    // Output: 3

    pop()
    Description: Removes the element present at the top of the Stack instance and returns it.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo $stack->pop();
    // Output: 3
    print_r($stack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 )

    push()
    Description: Adds elements to the end of the stack.
    Example:

    $stack = new \Ds\Stack([1, 2]);
    $stack->push(3, 4);
    print_r($stack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

    count()
    Description: Returns the number of elements present in the stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo $stack->count();
    // Output: 3

    allocate()
    Description: Allocates enough memory for a required capacity. This can improve performance when the stack grows.
    Example:

    $stack = new \Ds\Stack();
    $stack->allocate(10);
    echo $stack->capacity();
    // Output: 10

    capacity()
    Description: Returns the current capacity of the stack.
    Example:

    $stack = new \Ds\Stack();
    $stack->allocate(20);
    echo $stack->capacity();
    // Output: 20

    contains()
    Description: Checks if the stack contains one or more specified values.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo $stack->contains(2);
    // Output: 1 (true)

    merge()
    Description: Merges the stack with another iterable and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $mergedStack = $stack->merge([4, 5]);
    print_r($mergedStack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )

    reverse()
    Description: Reverses the elements of the stack in place.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $stack->reverse();
    print_r($stack);
    // Output: Ds\Stack Object ( [0] => 3 [1] => 2 [2] => 1 )

    reversed()
    Description: Returns a new stack with elements in reverse order.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $reversedStack = $stack->reversed();
    print_r($reversedStack);
    // Output: Ds\Stack Object ( [0] => 3 [1] => 2 [2] => 1 )

    reduce()
    Description: Reduces the stack to a single value using a callback function.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $sum = $stack->reduce(function ($carry, $item) {
        return $carry + $item;
    }, 0);
    echo $sum;
    // Output: 6

    filter()
    Description: 
    Filters the stack based on a callback function and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 4]);
    $filteredStack = $stack->filter(function ($value) {
        return $value % 2 === 0;
    });
    print_r($filteredStack);
    // Output: Ds\Stack Object ( [0] => 2 [1] => 4 )

    map()
    Description: Applies a callback function to all elements in the stack and returns a new stack with the results.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $mappedStack = $stack->map(function ($value) {
        return $value * 2;
    });
    print_r($mappedStack);
    // Output: Ds\Stack Object ( [0] => 2 [1] => 4 [2] => 6 )

    merge()
    Description: Merges another set or array into the current set.
    Example:

    $set = new \Ds\Set([1, 2]);
    $result = $set->merge([3, 4]);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3, [3] => 4)

    slice()
    Description: Returns a subset of the stack as a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 4]);
    $slicedStack = $stack->slice(1, 2);
    print_r($slicedStack);
    // Output: Ds\Stack Object ( [0] => 2 [1] => 3 )

    sort()
    Description: Sorts the elements of the stack in place.
    Example:

    $stack = new \Ds\Stack([3, 1, 2]);
    $stack->sort();
    print_r($stack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 )

    reverse()
    Description: Reverses the order of elements in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->reverse();
    print_r($set);
    // Output: Ds\Set Object ([0] => 3, [1] => 2, [2] => 1)

    sorted()
    Description: Returns a new stack with elements sorted in ascending order.
    Example:

    $stack = new \Ds\Stack([3, 1, 2]);
    $sortedStack = $stack->sorted();
    print_r($sortedStack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 )

    join()
    Description: Joins all elements of the stack into a string using a specified delimiter.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo $stack->join(", ");
    // Output: 1, 2, 3

    findIndex() (Custom Implementation)
    Description: Finds the index of the first occurrence of a specific value.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 2]);
    $index = array_search(2, $stack->toArray());
    echo $index;
    // Output: 1

    containsAll() (Custom Implementation)
    Description: Checks if the stack contains all the specified values.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $containsAll = array_diff([1, 2], $stack->toArray()) === [];
    echo $containsAll;
    // Output: 1 (true)

    sum()
    Description: Returns the sum of all elements in the set.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    echo array_sum($stack->toArray());
    // Output: 6

    unique() (Custom Implementation)
    Description: Removes duplicate elements from the stack and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 2, 3]);
    $uniqueStack = new \Ds\Stack(array_unique($stack->toArray()));
    print_r($uniqueStack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 )

    shuffle() (Custom Implementation)
    Description: Randomly shuffles the elements of the stack and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 4]);
    $shuffledArray = $stack->toArray();
    shuffle($shuffledArray);
    $shuffledStack = new \Ds\Stack($shuffledArray);
    print_r($shuffledStack);
    // Output: Ds\Stack Object ( [0] => 3 [1] => 1 [2] => 4 [3] => 2 ) (varies)

    reverseElements() (Custom Implementation)
    Description: Reverses the stack elements and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $reversedStack = new \Ds\Stack(array_reverse($stack->toArray()));
    print_r($reversedStack);
    // Output: Ds\Stack Object ( [0] => 3 [1] => 2 [2] => 1 )

    product() (Custom Implementation)
    Description: Calculates the product of all elements in the stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 4]);
    $product = array_product($stack->toArray());
    echo $product;
    // Output: 24

    min() (Custom Implementation)
    Description: Finds the minimum value in the stack.
    Example:

    $stack = new \Ds\Stack([3, 1, 4, 2]);
    echo min($stack->toArray());
    // Output: 1

    max() (Custom Implementation)
    Description: Finds the maximum value in the stack.
    Example:

    $stack = new \Ds\Stack([3, 1, 4, 2]);
    echo max($stack->toArray());
    // Output: 4

    swapTop() (Custom Implementation)
    Description: Swaps the top two elements of the stack.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $array = $stack->toArray();
    list($array[0], $array[1]) = [$array[1], $array[0]];
    $stack = new \Ds\Stack($array);
    print_r($stack);
    // Output: Ds\Stack Object ( [0] => 2 [1] => 1 [2] => 3 )

    concat()
    Description: Concatenates the current stack with another iterable and returns a new stack.
    Example:

    $stack = new \Ds\Stack([1, 2]);
    $concatenatedStack = new \Ds\Stack([...$stack->toArray(), ...[3, 4]]);
    print_r($concatenatedStack);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 )

    rotate() (Custom Implementation)
    Description: Rotates the stack by moving the top element to the bottom.
    Example:

    $stack = new \Ds\Stack([1, 2, 3]);
    $array = $stack->toArray();
    array_unshift($array, array_pop($array));
    $rotatedStack = new \Ds\Stack($array);
    print_r($rotatedStack);
    // Output: Ds\Stack Object ( [0] => 3 [1] => 1 [2] => 2 )

    chunk() (Custom Implementation)
    Description: Splits the stack into chunks of a specified size.
    Example:

    $stack = new \Ds\Stack([1, 2, 3, 4, 5]);
    $chunks = array_chunk($stack->toArray(), 2);
    foreach ($chunks as $chunk) {
        print_r(new \Ds\Stack($chunk));
    }
    // Output:
    // Ds\Stack Object ( [0] => 1 [1] => 2 )
    // Ds\Stack Object ( [0] => 3 [1] => 4 )
    // Ds\Stack Object ( [0] => 5 )

    flatten() (Custom Implementation)
    Description: Flattens a multi-dimensional stack into a single-level stack.
    Example:

    $stack = new \Ds\Stack([[1, 2], [3, 4], 5]);
    $flattened = new \Ds\Stack(array_merge(...$stack->toArray()));
    print_r($flattened);
    // Output: Ds\Stack Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )
  • Ds\Map Function

    Basic Ds\Map Function

    allocate()
    Description: Allocates enough memory for the required capacity.
    Example:

    $set = new \Ds\Set();
    $set->add(1, 2, 3);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    apply()
    Description: Applies a specific operation to all of the elements present in the map.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map->apply(function($key, $value) {
        return strtoupper($value);
    });
    // Output: Map with values ["ONE", "TWO"]

    capacity()
    Description: Returns the current capacity of the set.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    echo $map->capacity();
    // Output: Capacity of the map (e.g., 2)

    clear()
    Description: Removes all values from the set.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map->clear();
    // Output: The map is now empty.

    __construct()
    Description: 
    Creates a new instance of a Map.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    // Output: A map with key-value pairs [1 => "One", 2 => "Two"]

    copy()
    Description: Gets a shallow copy of the specified Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $copy = $map->copy();
    // Output: A shallow copy of the map [1 => "One", 2 => "Two"]

    copy()
    Description: Returns a shallow copy of the set.
    Example:

    $result = gmp_div_qr("10", "3");
    // Output: ([quotient => 3, remainder => 1])

    count()
    Description: Counts the number of values in the set.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    echo $map->count();
    // Output: 2

    diff()
    Description: Creates a new set with elements in the current set but not in the given set.
    Example:

    $map1 = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map2 = new \Ds\Map([2 => "Two", 3 => "Three"]);
    $diffMap = $map1->diff($map2);
    // Output: Map with [1 => "One"]

    filter()
    Description: Creates a new set with values that pass a callback function.
    Example:

    $set = new \Ds\Set([1, 2, 3, 4]);
    $result = $set->filter(fn($value) => $value % 2 === 0);
    print_r($result);
    // Output: Ds\Set Object ([0] => 2, [1] => 4)

    first()
    Description: Gets the first key-value pair from the Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $first = $map->first();
    // Output: Pair with [1 => "One"]

    get()
    Description: Returns the value of the given key.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    echo $map->get(1);
    // Output: "One"

    hasKey()
    Description: Checks whether a given Key is present in the Map object.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    echo $map->hasKey(1);
    // Output: 1 (true)

    intersect()
    Description: Creates a new set with elements common to both sets.
    Example:

    $map1 = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map2 = new \Ds\Map([2 => "Two", 3 => "Three"]);
    $intersection = $map1->intersect($map2);
    // Output: Map with [2 => "Two"]

    isEmpty()
    Description: Checks whether a given Map is empty or not.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    echo $map->isEmpty();
    // Output:  (false)

    keys()
    Description: Returns the set of keys of the current Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $keys = $map->keys();
    // Output: [1, 2]

    ksort()
    Description: Sorts the map elements in-place by key.
    Example:

    $map = new \Ds\Map([2 => "Two", 1 => "One"]);
    $map->ksort();
    // Output: Map with [1 => "One", 2 => "Two"]

    ksorted()
    Description: Returns a copy which is sorted by key.
    Example:

    $map = new \Ds\Map([2 => "Two", 1 => "One"]);
    $sortedMap = $map->ksorted();
    // Output: Map with [1 => "One", 2 => "Two"]

    last()
    Description: Finds and gets the last key-value pair from a Map object.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $last = $map->last();
    // Output: Pair with [2 => "Two"]

    remove()
    Description: Removes specific values from the set.
    Example:

    $set = new \Ds\Set([1, 2, 3, 4]);
    $set->remove(2, 4);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 3)

    map()
    Description: Applies a callback function to a Map object.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $newMap = $map->map(function($key, $value) {
        return strtoupper($value);
    });
    // Output: Map with [1 => "ONE", 2 => "TWO"]

    merge()
    Description: Returns the result of adding all given associations.
    Example:

    $map1 = new \Ds\Map([1 => "One"]);
    $map2 = new \Ds\Map([2 => "Two"]);
    $mergedMap = $map1->merge($map2);
    // Output: Map with [1 => "One", 2 => "Two"]

    slice()
    Description: Returns a subset of the set based on the specified range.
    Example:

    $result = gmp_nextprime("100");
    // Output: (next prime is 101)

    pairs()
    Description: Gets all of the pairs from the specified Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $pairs = $map->pairs();
    // Output: Pair objects [1 => "One", 2 => "Two"]

    put()
    Description: Associates a key with a value.
    Example:

    $set = new \Ds\Set([3, 1, 2]);
    $result = $set->sorted();
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    putAll()
    Description: Associates all key-value pairs of a traversable object or array.
    Example:

    $map = new \Ds\Map([1 => "One"]);
    $map->putAll([2 => "Two", 3 => "Three"]);
    // Output: Map with [1 => "One", 2 => "Two", 3 => "Three"]

    reduce()
    Description: Reduces the map to a single value by applying operations using the callback function.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $result = $map->reduce(function($carry, $item) {
        return $carry . $item;
    }, "");
    // Output: "OneTwo"

    reverse()
    Description: In-place reverse the elements of a specified Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map->reverse();
    // Output: Map with [2 => "Two", 1 => "One"]

    reversed()
    Description: Gets a copy of the reverse of elements of a specified Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $reversedMap = $map->reversed();
    // Output: Map with [2 => "Two", 1 => "One"]

    skip()
    Description: Returns the pair at a given positional index.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $pair = $map->skip(1);
    // Output: Pair with [2 => "Two"]

    slice()
    Description: Gets a subset of the specified Map instance.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two", 3 => "Three"]);
    $subset = $map->slice(0, 2);
    // Output: Map with [1 => "One", 2 => "Two"]

    sort()
    Description: In-place sort the elements of a specified Map instance according to the values.
    Example:

    $map = new \Ds\Map([2 => "Two", 1 => "One"]);
    $map->sort();
    // Output: Map with [1 => "One", 2 => "Two"]

    sorted()
    Description: Gets a copy of the specified Map instance sorted according to the values.
    Example:

    $map = new \Ds\Map([2 => "Two", 1 => "One"]);
    $sortedMap = $map->sorted();
    // Output: Map with [1 => "One", 2 => "Two"]

    sum()
    Description: Gets the sum of all of the values present in the Map instance.
    Example:

    $map = new \Ds\Map([1 => 1, 2 => 2, 3 => 3]);
    $sum = $map->sum();
    // Output: 6

    toArray()
    Description: Gets an array generated by converting the Map instance into an Array.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $array = $map->toArray();
    // Output: [1 => "One", 2 => "Two"]

    union()
    Description: Creates a new map that contains the union of two maps.
    Example:

    $map1 = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map2 = new \Ds\Map([3 => "Three", 4 => "Four"]);
    $unionMap = $map1->union($map2);
    // Output: Map with [1 => "One", 2 => "Two", 3 => "Three", 4 => "Four"]

    values()
    Description: Returns a sequence of the map’s values.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $values = $map->values();
    // Output: ["One", "Two"]

    xor()
    Description: Creates a new map that contains the value either in the first map or the second map, but not both.
    Example:

    $map1 = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map2 = new \Ds\Map([2 => "Two", 3 => "Three"]);
    $xorMap = $map1->xor($map2);
    // Output: Map with [1 => "One", 3 => "Three"]

    mergeRecursive()
    Description: Recursively merges all key-value pairs from the provided map into the current map.
    Example:

    $map1 = new \Ds\Map([1 => "One", 2 => "Two"]);
    $map2 = new \Ds\Map([2 => "Second", 3 => "Three"]);
    $mergedMap = $map1->mergeRecursive($map2);
    // Output: Map with [1 => "One", 2 => "Second", 3 => "Three"]

    pop()
    Description: Removes and returns the last key-value pair from the map.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $last = $map->pop();
    // Output: Pair with [2 => "Two"], and the map becomes [1 => "One"]

    push()
    Description: Adds a key-value pair to the end of the map.
    Example:

    $map = new \Ds\Map([1 => "One"]);
    $map->push(2, "Two");
    // Output: Map with [1 => "One", 2 => "Two"]

    shift()
    Description: Removes and returns the first key-value pair from the map.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $first = $map->shift();
    // Output: Pair with [1 => "One"], and the map becomes [2 => "Two"]

    sliceKeys()
    Description: Returns a subset of the map containing only the specified keys.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two", 3 => "Three"]);
    $sliced = $map->sliceKeys([1, 3]);
    // Output: Map with [1 => "One", 3 => "Three"]

    mapKeys()
    Description: Transforms the keys of the map using a given callback function.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $newMap = $map->mapKeys(function($key) {
        return $key * 2;
    });
    // Output: Map with [2 => "One", 4 => "Two"]

    swap()
    Description: Swaps the positions of two elements in the map using their keys.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two", 3 => "Three"]);
    $map->swap(1, 3);
    // Output: Map with [3 => "One", 2 => "Two", 1 => "Three"]

    mapKeys()
    Description: Transforms the keys of the map using a given callback function.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $newMap = $map->mapKeys(function($key) {
        return $key * 2;
    });
    // Output: Map with [2 => "One", 4 => "Two"]

    unique()
    Description: Removes duplicate values from the map.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "One", 3 => "Two"]);
    $uniqueMap = $map->unique();
    // Output: Map with [1 => "One", 3 => "Two"]

    find()
    Description: Finds and returns the key of a given value.
    Example:

    $map = new \Ds\Map([1 => "One", 2 => "Two"]);
    $key = $map->find("Two");
    // Output: 2
  • Ds\Set Functions

    Basic Ds\Set Functions

    add()
    Description: Adds one or more values to the set.
    Example:

    $set = new \Ds\Set();
    $set->add(1, 2, 3);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    allocate()
    Description: Allocates memory for a given capacity.
    Example:

    $set = new \Ds\Set();
    $set->allocate(10);
    // Output: (allocates memory for 10 elements)

    capacity()
    Description: Returns the current capacity of the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->capacity();
    // Output: (capacity is 3)

    clear()
    Description: Removes all values from the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->clear();
    print_r($set);
    // Output: Ds\Set Object ()

    __construct()
    Description: Creates a new instance of a set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    contains()
    Description: Checks if the given value exists in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    var_dump($set->contains(2));
    // Output: (bool true)

    copy()
    Description: Returns a shallow copy of the set.
    Example:

    $result = gmp_div_qr("10", "3");
    // Output: ([quotient => 3, remainder => 1])

    count()
    Description: Counts the number of values in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->count();
    // Output: (3)

    diff()
    Description: Creates a new set with elements in the current set but not in the given set.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([2, 3, 4]);
    $result = $set1->diff($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1)

    filter()
    Description: Creates a new set with values that pass a callback function.
    Example:

    $set = new \Ds\Set([1, 2, 3, 4]);
    $result = $set->filter(fn($value) => $value % 2 === 0);
    print_r($result);
    // Output: Ds\Set Object ([0] => 2, [1] => 4)

    first()
    Description: Returns the first value in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->first();
    // Output: (1)

    get()
    Description: Retrieves a value by its index.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->get(1);
    // Output: (2)

    gmp_gcdext()
    Description: Calculates the GCD and multipliers for the equation.
    Example:

    $result = gmp_gcdext("48", "18");
    // Output: ([gcd => 6, s => -1, t => 3])

    intersect()
    Description: Creates a new set with elements common to both sets.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([2, 3, 4]);
    $result = $set1->intersect($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 2, [1] => 3)

    isEmpty()
    Description: Checks whether the set is empty.
    Example:

    $set = new \Ds\Set();
    var_dump($set->isEmpty());
    // Output: (bool true)

    join()
    Description: Joins all elements of the set into a string.
    Example:

    $set = new \Ds\Set(["a", "b", "c"]);
    echo $set->join(", ");
    // Output: (a, b, c)

    last()
    Description: Returns the last value in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->last();
    // Output: (3)

    merge()
    Description: Merges another set or array into the current set.
    Example:

    $set = new \Ds\Set([1, 2]);
    $result = $set->merge([3, 4]);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3, [3] => 4)

    reduce()
    Description: Reduces the set to a single value using a callback.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $result = $set->reduce(fn($carry, $value) => $carry + $value, 0);
    echo $result;
    // Output: (6)

    remove()
    Description: Removes specific values from the set.
    Example:

    $set = new \Ds\Set([1, 2, 3, 4]);
    $set->remove(2, 4);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 3)

    reverse()
    Description: Reverses the order of elements in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->reverse();
    print_r($set);
    // Output: Ds\Set Object ([0] => 3, [1] => 2, [2] => 1)

    reversed()
    Description: Creates a new set with values in reverse order.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $result = $set->reversed();
    print_r($result);
    // Output: Ds\Set Object ([0] => 3, [1] => 2, [2] => 1)

    slice()
    Description: Returns a subset of the set based on the specified range.
    Example:

    $result = gmp_nextprime("100");
    // Output: (next prime is 101)

    sort()
    Description: Sorts the elements of the set in-place.
    Example:

    $set = new \Ds\Set([3, 1, 2]);
    $set->sort();
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    sorted()
    Description: Returns a new set with elements sorted in ascending order.
    Example:

    $set = new \Ds\Set([3, 1, 2]);
    $result = $set->sorted();
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    sum()
    Description: Returns the sum of all elements in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->sum();
    // Output: (6)

    toArray()
    Description: Converts the set into an array.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    print_r($set->toArray());
    // Output: Array ([0] => 1, [1] => 2, [2] => 3)

    union()
    Description: Creates a new set that contains the union of two sets.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([3, 4, 5]);
    $result = $set1->union($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3, [3] => 4, [4] => 5)

    xor()
    Description: Creates a new set containing values that exist in either set but not both.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([3, 4, 5]);
    $result = $set1->xor($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 4, [3] => 5)

    add()
    Description: Adds values to the set.
    Example:

    $set = new \Ds\Set([1, 2]);
    $set->add(3);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    allocate()
    Description: Allocates memory for the required capacity of the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->allocate(10);
    echo "Capacity: " . $set->capacity();
    // Output: Capacity: 10

    capacity()
    Description: Returns the capacity of the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->capacity();
    // Output: 8 (The default capacity may vary based on implementation)

    clear()
    Description: Removes all values from the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $set->clear();
    print_r($set);
    // Output: Ds\Set Object () (empty set)

    __construct()
    Description: Creates a new instance of a set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    print_r($set);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    contains()
    Description: Checks if a given value exists in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->contains(2);
    // Output: 1 (true)

    copy()
    Description: Returns a copy of the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    $copy = $set->copy();
    print_r($copy);
    // Output: Ds\Set Object ([0] => 1, [1] => 2, [2] => 3)

    count()
    Description: Counts the number of values present in the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->count();
    // Output: 3

    diff()
    Description: Creates a set containing the elements of the first set that are not present in the second set.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([3, 4, 5]);
    $result = $set1->diff($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 1, [1] => 2)

    filter()
    Description: Creates a new set using a filter function.
    Example:

    $set = new \Ds\Set([1, 2, 3, 4]);
    $result = $set->filter(function($value) {
        return $value > 2;
    });
    print_r($result);
    // Output: Ds\Set Object ([0] => 3, [1] => 4)

    first()
    Description: Returns the first element of the set.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->first();
    // Output: 1

    get()
    Description: Gets a value from the set instance.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->get(1);
    // Output: 2 (Gets the value at index 1)

    intersect()
    Description: Creates a new set that contains the intersection of two sets.
    Example:

    $set1 = new \Ds\Set([1, 2, 3]);
    $set2 = new \Ds\Set([2, 3, 4]);
    $result = $set1->intersect($set2);
    print_r($result);
    // Output: Ds\Set Object ([0] => 2, [1] => 3)

    isEmpty()
    Description: Checks whether the set is empty or not.
    Example:

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->isEmpty() ? 'Yes' : 'No';
    // Output: No

    join()
    Description: Joins all values in the set as a string.

    $set = new \Ds\Set([1, 2, 3]);
    echo $set->join(', ');
    // Output: 1, 2, 3
  • GMP Functions

    Basic GMP Functions

    gmp_abs()
    Description: Calculates the absolute value of a GMP number.
    Example:

    $result = gmp_abs("-42");
    // Output: (absolute value is 42)

    gmp_add()
    Description: Adds two GMP numbers.
    Example:

    $result = gmp_add("123", "456");
    // Output: (sum is 579)

    gmp_clrbit()
    Description: Sets the bit at a specified index in a GMP number to 0.
    Example:

    $num = gmp_init("15");
    gmp_clrbit($num, 1);
    // Output: (number becomes 13 after clearing bit 1)

    gmp_cmp()
    Description: Compares two GMP numbers.
    Example:

    $result = gmp_cmp("100", "200");
    // Output: (-1 because 100 < 200)

    gmp_com()
    Description: Calculates the one’s complement of a GMP number.
    Example:

    $result = gmp_com("5");
    // Output: (-6, the one's complement of 5)

    gmp_div_q()
    Description: Performs division of GMP numbers, returning the quotient.
    Example:

    $result = gmp_div_q("10", "3");
    // Output: (quotient is 3)

    gmp_div_qr()
    Description: Performs division and returns both quotient and remainder.
    Example:

    $result = gmp_div_qr("10", "3");
    // Output: ([quotient => 3, remainder => 1])

    gmp_div_r()
    Description: Performs division and returns only the remainder.
    Example:

    $result = gmp_div_r("10", "3");
    // Output: (remainder is 1)

    gmp_divexact()
    Description: Divides exactly when one GMP number is divisible by another.
    Example:

    $result = gmp_divexact("10", "2");
    // Output: (exact quotient is 5)

    gmp_export()
    Description: Exports a GMP number to a binary string.
    Example:

    $result = gmp_export("255");
    // Output: ("\xFF" - binary string representation of 255)

    gmp_fact()
    Description: Calculates the factorial of a GMP number.
    Example:

    $result = gmp_fact("5");
    // Output: (factorial is 120)

    gmp_gcd()
    Description: Calculates the GCD of two GMP numbers.
    Example:

    $result = gmp_gcd("48", "18");
    // Output: (GCD is 6)

    gmp_gcdext()
    Description: Calculates the GCD and multipliers for the equation.
    Example:

    $result = gmp_gcdext("48", "18");
    // Output: ([gcd => 6, s => -1, t => 3])

    gmp_hamdist()
    Description: Finds the Hamming distance between two GMP numbers.
    Example:

    $result = gmp_hamdist("5", "7");
    // Output: (Hamming distance is 1)

    gmp_import()
    Description: Imports a GMP number from a binary string.
    Example:

    $result = gmp_import("\xFF");
    // Output: (GMP number is 255)

    gmp_intval()
    Description: Converts a GMP number to an integer.
    Example:

    $result = gmp_intval("123456789");
    // Output: (integer is 123456789)

    gmp_invert()
    Description: Finds the modular inverse of a GMP number.
    Example:

    $result = gmp_invert("3", "7");
    // Output: (modular inverse is 5)

    gmp_jacobi()
    Description: Computes the Jacobi symbol of two GMP numbers.
    Example:

    $result = gmp_jacobi("3", "7");
    // Output: (Jacobi symbol is 1)

    gmp_legendre()
    Description: Computes the Legendre symbol of two GMP numbers.
    Example:

    $result = gmp_legendre("3", "7");
    // Output: (Legendre symbol is 1)

    gmp_mod()
    Description: Finds the modulo of a GMP number.
    Example:

    $result = gmp_mod("10", "3");
    // Output: (modulo is 1)

    gmp_mul()
    Description: Multiplies two GMP numbers.
    Example:

    $result = gmp_mul("123", "456");
    // Output: (product is 56088)

    gmp_neg()
    Description: Returns the negative of a GMP number.
    Example:

    $result = gmp_neg("42");
    // Output: (-42)

    gmp_nextprime()
    Description: Finds the smallest prime number greater than the given GMP number.
    Example:

    $result = gmp_nextprime("100");
    // Output: (next prime is 101)

    Gmagick::medianFilterImage()
    Description: Reduces noise in the image using a median filter.
    Example:

    $image->medianFilterImage(2);
    // Output: (reduces image noise with a radius of 2)

    gmp_perfect_square()
    Description: Checks if the given GMP number is a perfect square.
    Example:

    $result = gmp_perfect_square("49");
    // Output: (true, because 49 is a perfect square)

    gmp_popcount()
    Description: Finds the population count (number of set bits) in a GMP number.
    Example:

    $result = gmp_popcount("15");
    // Output: (population count is 4)

    gmp_pow()
    Description: Raises a GMP number to the power of an integer.
    Example:

    $result = gmp_pow("2", "10");
    // Output: (1024)

    gmp_prob_prime()
    Description: Checks the probability of a GMP number being prime.
    Example:

    $result = gmp_prob_prime("101");
    // Output: (value 2, meaning 101 is definitely prime)

    gmp_random_bits()
    Description: Generates a random number with a specified number of bits.
    Example:

    $result = gmp_random_bits(10);
    // Output: (random number with up to 10 bits, e.g., 745)

    gmp_random_range()
    Description: Generates a random number within a specified range.
    Example:

    $result = gmp_random_range("1", "100");
    // Output: (random number between 1 and 100)

    gmp_random_seed()
    Description: Sets the seed for the random number generator.
    Example:

    gmp_random_seed("123");
    // Output: (sets the RNG seed to 123)

    gmp_root()
    Description: Calculates the integer part of the N-th root of a GMP number.
    Example:

    $result = gmp_root("27", "3");
    // Output: (cube root is 3)

    gmp_rootrem()
    Description: Calculates the N-th root and the remainder.
    Example:

    list($root, $remainder) = gmp_rootrem("28", "3");
    // Output: (root is 3, remainder is 1)

    gmp_scan0()
    Description:
    Scans for the first occurrence of the bit “0” in a GMP number.
    Example:

    $result = gmp_scan0("15", 1);
    // Output: (first 0-bit is at index 4)

    gmp_scan1()
    Description:
    Scans for the first occurrence of the bit “1” in a GMP number.
    Example:

    $result = gmp_scan1("8", 0);
    // Output: (first 1-bit is at index 3)

    gmp_setbit()
    Description: Sets a specific bit in a GMP number.
    Example:

    $num = gmp_init("0");
    gmp_setbit($num, 3);
    // Output: (number becomes 8)

    gmp_sign()
    Description: Checks the sign of a GMP number.
    Example:

    $result = gmp_sign("-42");
    // Output: (-1 because the number is negative)

    gmp_sqrt()
    Description: Calculates the square root of a GMP number.
    Example:

    $result = gmp_sqrt("49");
    // Output: (square root is 7)

    gmp_sqrtrem()
    Description: Calculates the square root and remainder of a GMP number.
    Example:

    list($sqrt, $remainder) = gmp_sqrtrem("50");
    // Output: (square root is 7, remainder is 1)

    gmp_strval()
    Description: Returns the string representation of a GMP number.
    Example:

    $result = gmp_strval("12345");
    // Output: ("12345")

    gmp_sub()
    Description: Subtracts one GMP number from another.
    Example:

    $result = gmp_sub("100", "42");
    // Output: (difference is 58)

    gmp_testbit()
    Description: Checks if a specific bit in a GMP number is set.
    Example:

    $result = gmp_testbit("8", 3);
    // Output: (true because bit 3 is set)

    gmp_xor()
    Description: Calculates the XOR of two GMP numbers.
    Example:

    $result = gmp_xor("10", "5");
    // Output: (result is 15)

    gmp_random()
    Description: Generates a random GMP number.
    Example:

    $result = gmp_random(5);
    // Output: (random number with 5 limbs)
  • Gmagick Functions

    Basic Gmagick Functions

    The Gmagick class provides a wrapper to the GraphicsMagick library, which is used to create, edit, and manipulate images.

    Gmagick::addImage()
    Description: Adds a new image to the Gmagick object image list.
    Example:

    $image->addImage($newImage);
    // Output: (adds a new image to the current Gmagick image list)

    Gmagick::blurImage()
    Description: Applies a blur filter to the image.
    Example:

    $image->blurImage(5, 3);
    // Output: (applies a blur with radius 5 and sigma 3 to the image)

    Gmagick::cropImage()
    Description: Extracts a specific region from the image.
    Example:

    $image->cropImage(100, 100, 50, 50);
    // Output: (crops a 100x100 region starting at coordinates (50, 50))

    Gmagick::flipImage()
    Description: Creates a mirror image by reflecting the pixels along the x-axis.
    Example:

    $image->flipImage();
    // Output: (creates a flipped version of the image along the x-axis)

    Gmagick::rotateImage()
    Description: Rotates the image by the specified number of degrees.
    Example:

    $image->rotateImage('#FFFFFF', 90);
    // Output: (rotates the image by 90° with a white background)

    Gmagick::resizeImage()
    Description: Scales the image to specified dimensions using a filter.
    Example:

    $image->resizeImage(200, 150, Gmagick::FILTER_LANCZOS, 1);
    // Output: (resizes the image to 200x150 pixels using Lanczos filter)

    Gmagick::oilPaintImage()
    Description: Applies a special effect filter that simulates an oil painting.
    Example:

    $image->oilPaintImage(3);
    // Output: (applies an oil-paint effect to the image with radius 3)

    Gmagick::addNoiseImage()
    Description: Adds noise to the image.
    Example:

    $image->addNoiseImage(Gmagick::NOISE_POISSON);
    // Output: (adds Poisson noise to the image)

    Gmagick::annotateImage()
    Description: Annotates an image with text.
    Example:

    $image->annotateImage($draw, 10, 50, 0, 'Sample Text');
    // Output: (adds the text "Sample Text" to the image at coordinates (10, 50))

    Gmagick::borderImage()
    Description: Draws a border around the image.
    Example:

    $image->borderImage('#000000', 10, 10);
    // Output: (adds a black border of 10px width to the image)

    Gmagick::charcoalImage()
    Description: Simulates a charcoal sketch effect.
    Example:

    $image->charcoalImage(2, 1);
    // Output: (applies a charcoal effect to the image with radius 2 and sigma 1)

    Gmagick::chopImage()
    Description: Removes a region from the image and trims it.
    Example:

    $image->chopImage(100, 100, 50, 50);
    // Output: (removes a 100x100 region starting at coordinates (50, 50))

    Gmagick::clear()
    Description: Clears all resources associated with the Gmagick object.
    Example:

    $image->clear();
    // Output: (releases memory and clears all resources)

    Gmagick::commentImage()
    Description: Adds a comment to the image.
    Example:

    $image->commentImage('This is a sample comment.');
    // Output: (attaches the comment "This is a sample comment" to the image)

    Gmagick::cropThumbnailImage()
    Description: Creates a fixed-size thumbnail by scaling and cropping the image.
    Example:

    $image->cropThumbnailImage(150, 150);
    // Output: (creates a 150x150 thumbnail of the image)

    Gmagick::drawImage()
    Description: Renders a GmagickDraw object onto the image.
    Example:

    $image->drawImage($draw);
    // Output: (draws the specified shapes or text on the image)

    Gmagick::edgeImage()
    Description: Enhances the edges of the image using a convolution filter.
    Example:

    $image->edgeImage(1);
    // Output: (enhances the edges of the image with radius 1)

    Gmagick::embossImage()
    Description: Applies a three-dimensional grayscale emboss effect.
    Example:

    $image->embossImage(2, 1);
    // Output: (applies an emboss effect with radius 2 and sigma 1)

    Gmagick::enhanceImage()
    Description: Applies a digital filter to improve image quality.
    Example:

    $image->enhanceImage();
    // Output: (improves the quality of the image)

    Gmagick::equalizeImage()
    Description: Equalizes the histogram of the image.
    Example:

    $image->equalizeImage();
    // Output: (adjusts image contrast by equalizing its histogram)

    Gmagick::flopImage()
    Description: Creates a mirror image along the y-axis.
    Example:

    $image->flopImage();
    // Output: (creates a mirrored version of the image along the y-axis)

    Gmagick::gammaImage()
    Description: Applies gamma correction to the image.
    Example:

    $image->gammaImage(1.5);
    // Output: (applies a gamma correction with a factor of 1.5)

    Gmagick::implodeImage()
    Description: Creates an implosion effect on the image.
    Example:

    $image->implodeImage(0.5);
    // Output: (creates an imploded version of the image with a factor of 0.5)

    Gmagick::medianFilterImage()
    Description: Reduces noise in the image using a median filter.
    Example:

    $image->medianFilterImage(2);
    // Output: (reduces image noise with a radius of 2)

    Gmagick::motionBlurImage()
    Description: Simulates motion blur in the image.
    Example:

    $image->motionBlurImage(5, 3, 45);
    // Output: (applies a motion blur with radius 5, sigma 3, and angle 45°)

    Gmagick::normalizeImage()
    Description: Enhances the contrast of the image by adjusting pixel colors to span the entire color range.
    Example:

    $image->normalizeImage();
    // Output: (enhances the image contrast by normalizing its pixel colors)

    Gmagick::raiseImage()
    Description: Adds a simulated three-dimensional effect by raising the edges of the image.
    Example:

    $image->raiseImage(10, 10, 5, 5, true);
    // Output: (creates a raised edge effect with a 10x10 rectangle inset by 5 pixels)

    Gmagick::reduceNoiseImage()
    Description: Smooths contours of the image while preserving edges.
    Example:

    $image->reduceNoiseImage(3);
    // Output: (reduces noise in the image with a threshold of 3)

    Gmagick::resampleImage()
    Description: Resamples the image to the desired resolution.
    Example:

    $image->resampleImage(300, 300, Gmagick::FILTER_LANCZOS, 1);
    // Output: (resamples the image to 300 DPI with Lanczos filter)

    Gmagick::rollImage()
    Description: Rolls the image horizontally and vertically.
    Example:

    $image->rollImage(50, 25);
    // Output: (shifts the image 50 pixels horizontally and 25 pixels vertically)

    Gmagick::scaleImage()
    Description: Scales the image to the specified dimensions.
    Example:

    $image->scaleImage(300, 200);
    // Output: (resizes the image to 300x200 pixels)

    Gmagick::setImageDepth()
    Description: Sets the bit depth for the image.
    Example:

    $image->setImageDepth(16);
    // Output: (sets the image depth to 16 bits)

    Gmagick::setImageResolution()
    Description: Sets the resolution of the image.
    Example:

    $image->setImageResolution(300, 300);
    // Output: (sets the image resolution to 300 DPI)

    Gmagick::shearImage()
    Description: Slides the edges of an image to create a parallelogram effect.
    Example:

    $image->shearImage('#FFFFFF', 30, 0);
    // Output: (applies a shear transformation with a 30° x-axis slope and a white background)

    Gmagick::solarizeImage()
    Description: Applies a solarize effect to the image.
    Example:

    $image->solarizeImage(128);
    // Output: (creates a solarized version of the image with a threshold of 128)

    Gmagick::spreadImage()
    Description: Randomly displaces pixels in the image.
    Example:

    $image->spreadImage(5);
    // Output: (displaces pixels randomly within a 5-pixel block)

    Gmagick::stripImage()
    Description: Removes all profiles and comments from the image.
    Example:

    $image->stripImage();
    // Output: (removes metadata such as profiles and comments from the image)

    Gmagick::swirlImage()
    Description: Swirls the pixels around the center of the image.
    Example:

    $image->swirlImage(90);
    // Output: (creates a swirl effect with a 90° rotation)

    Gmagick::magnifyImage()
    Description: Scales the image to twice its original size.
    Example:

    $image->magnifyImage();
    // Output: (enlarges the image to 2x its original size)

    Gmagick::minifyImage()
    Description: Scales the image to half its original size.
    Example:

    $image->minifyImage();
    // Output: (reduces the image size to 50% of its original dimensions)

    Gmagick::modulateImage()
    Description: Adjusts brightness, saturation, and hue of the image.
    Example:

    $image->modulateImage(100, 50, 120);
    // Output: (adjusts brightness to 100%, saturation to 50%, and hue to 120%)

    Gmagick::motionBlurImage()
    Description: Simulates motion blur in the image.
    Example:

    $image->motionBlurImage(10, 5, 45);
    // Output: (adds a motion blur effect with radius 10, sigma 5, and angle 45°)

    Gmagick::implodeImage()
    Description:
    Creates an implosion effect on the image.
    Example:

    $image->implodeImage(-1);
    // Output: (creates an exploded effect on the image)

    Gmagick::oilPaintImage()
    Description: Applies an oil painting effect to the image.
    Example:

    $image->oilPaintImage(3);
    // Output: (applies an oil painting effect with radius 3)

    Gmagick::rotateImage()
    Description: Rotates the image by the specified degrees.
    Example:

    $image->rotateImage('#FFFFFF', 45);
    // Output: (rotates the image by 45° with a white background fill)

    Gmagick::resizeImage()
    Description: Resizes the image to the given dimensions using a specific filter.
    Example:

    $image->resizeImage(200, 100, Gmagick::FILTER_LANCZOS, 1);
    // Output: (resizes the image to 200x100 pixels with the Lanczos filter)

    Gmagick::setImageChannelDepth()
    Description: Sets the depth of a specific image channel.
    Example:

    $image->setImageChannelDepth(Gmagick::CHANNEL_RED, 8);
    // Output: (sets the red channel depth to 8 bits)

    Gmagick::implodeImage()
    Description: Creates an implosion effect on the image.
    Example:

    $image->implodeImage(0.5);
    // Output: (applies an implosion effect with a factor of 0.5)

    Gmagick::spreadImage()
    Description: Randomly displaces pixels within a defined block size.
    Example:

    $image->spreadImage(5);
    // Output: (applies a random pixel displacement with a block size of 5)
  • PHP String Functions Complete Reference

    PHP String Functions Complete Reference

    The predefined math functions in PHP are used to handle mathematical operations with integer and float types. These math functions are built into PHP and do not require any additional installation.

    Installation: These functions do not require any special installation. The complete list of PHP math functions is given below:

    Example: A program illustrating the decbin() function in PHP:

    <?php
    echo decbin(45);
    ?>

    Output:

    101101

    ImagickDraw::annotation()
    Description: Draws text at specified coordinates on the image.
    Example:

    $draw->annotation(50, 100, "Sample Text");
    // Output: (draws "Sample Text" at position (50, 100))

    ImagickDraw::arc()
    Description: Draws an arc between two points with a specified start and end angle.
    Example:

    $draw->arc(50, 50, 200, 200, 0, 90);
    // Output: (draws an arc from 0° to 90° within the bounding box (50, 50) to (200, 200))

    ImagickDraw::bezier()
    Description: Draws a bezier curve using specified control points.
    Example:

    $draw->bezier([[10, 10], [30, 90], [60, 30], [80, 80]]);
    // Output: (draws a bezier curve passing through the defined points)

    ImagickDraw::circle()
    Description: Draws a circle with a center point and a point on the radius.
    Example:

    echo chop("Hello World!  ");
    // Output: Hello World!

    ImagickDraw::getStrokeOpacity()
    Description: Returns the opacity of stroked outlines.
    Example:

    echo $draw->getStrokeOpacity();
    // Output: (returns the opacity level of the stroke)

    ImagickDraw::getStrokeWidth()
    Description: Returns the stroke width used for outlines.
    Example:

    echo $draw->getStrokeWidth();
    // Output: (returns stroke width value)

    ImagickDraw::line()
    Description: Draws a line between two points.
    Example:

    $draw->line(10, 10, 300, 300);
    // Output: (draws a line from (10, 10) to (300, 300))

    ImagickDraw::point()
    Description: Draws a point at specified coordinates.
    Example:

    $draw->point(150, 150);
    // Output: (draws a point at coordinate (150, 150))

    ImagickDraw::polygon()
    Description: Draws a polygon using an array of vertex points.
    Example:

    $draw->polygon([[10, 10], [100, 50], [50, 100]]);
    // Output: (draws a polygon with vertices at the specified points)

    ImagickDraw::polyline()
    Description: Draws a series of connected lines through specified points.
    Example:

    $draw->polyline([[10, 20], [30, 40], [50, 60], [70, 80]]);
    // Output: (draws connected lines through the defined points)

    ImagickDraw::rectangle()
    Description: Draws a rectangle defined by two opposite corners.
    Example:

    $draw->rectangle(10, 10, 200, 100);
    // Output: (draws a rectangle from (10, 10) to (200, 100))

    ImagickDraw::rotate()
    Description: Applies rotation to the coordinate space.
    Example:

    echo password_hash("mypassword", PASSWORD_DEFAULT);
    // Output: $2y$10$...

    ImagickDraw::roundRectangle()
    Description: Draws a rectangle with rounded corners.
    Example:

    $draw->roundRectangle(10, 20, 200, 150, 20, 20);
    // Output: (draws a rectangle with rounded corners of radius 20)

    ImagickDraw::scale()
    Description: Applies scaling to the horizontal and vertical directions.
    Example:

    $draw->scale(1.5, 1.2);
    // Output: (scales coordinate space by 1.5 horizontally and 1.2 vertically)

    ImagickDraw::setFillColor()
    Description: Sets the color used for filling shapes.
    Example:

    $draw->setFillColor('green');
    // Output: (sets fill color to green)

    ImagickDraw::setFillOpacity()
    Description: Sets the opacity level for the fill color.
    Example:

    $draw->setFillOpacity(0.5);
    // Output: (sets fill opacity to 50%)

    ImagickDraw::setFont()
    Description: Sets the font for text drawing.
    Example:

    $draw->setFont('Courier');
    // Output: (sets text font to Courier)

    ImagickDraw::setFontFamily()
    Description: Sets the font family to use for text.
    Example:

    $draw->setFontFamily('Arial');
    // Output: (sets font family to Arial)

    ImagickDraw::setFontSize()
    Description: Specifies the font size for text.
    Example:

    $draw->setFontSize(20);
    // Output: (sets text font size to 20 points)

    ImagickDraw::setFontStyle()
    Description: Sets the style for text, such as italic or normal.
    Example:

    $draw->setFontStyle(Imagick::STYLE_NORMAL);
    // Output: (sets text font style to normal)

    ImagickDraw::setFontWeight()
    Description: Specifies the weight of the font for text.
    Example:

    $draw->setFontWeight(700);
    // Output: (sets font weight to bold)

    ImagickDraw::setGravity()
    Description: Sets the placement gravity for text.
    Example:

    $draw->setGravity(Imagick::GRAVITY_SOUTHWEST);
    // Output: (positions text relative to the southwest corner)

    ImagickDraw::setStrokeAlpha()
    Description: Specifies the opacity of stroke outlines.
    Example:

    $draw->setStrokeAlpha(0.6);
    // Output: (sets stroke opacity to 60%)

    ImagickDraw::setStrokeColor()
    Description: Sets the color for stroke outlines.
    Example:

    $draw->setStrokeColor('blue');
    // Output: (sets stroke color to blue)

    ImagickDraw::setStrokeLineJoin()
    Description: Defines the style of corners when paths are stroked.
    Example:

    $draw->setStrokeAlpha(0.6);
    // Output: (sets stroke opacity to 60%)

    ImagickDraw::setStrokeMiterLimit()
    Description: Sets the miter limit for the stroke.
    Example:

    $draw->setStrokeMiterLimit(5);
    // Output: (sets miter limit to 5)

    ImagickDraw::setStrokeOpacity()
    Description: Defines the opacity level for stroke outlines.
    Example:

    $draw->setStrokeOpacity(0.9);
    // Output: (sets stroke opacity to 90%)
  • PHP Imagick Functions Complete Reference

    PHP Imagick Functions Complete Reference

    PHP Overview: A Beginner’s Guide to Syntax

    PHP is a versatile server-side language widely used in web development. Its straightforward syntax makes it suitable for both beginners and advanced developers. In this guide, we will explore the basic syntax of PHP. PHP scripts can be embedded within HTML using special PHP tags.

    Basic PHP Syntax

    PHP code is executed between PHP tags. The most commonly used tags are <?php ... ?>, which mark the beginning and end of PHP code. This is known as Escaping to PHP.

    <?php
        // PHP code goes here
    ?>

    These tags, also known as Canonical PHP tags, indicate to the PHP parser which parts of the document to process. Everything outside these tags is treated as plain HTML. Each PHP command must end with a semicolon (;).

    PHP Syntax Example

    <?php
        // Using echo to display a message
        echo "Greetings from PHP!";
    ?>

    Output:

    Greetings from PHP!

    Imagick::adaptiveBlurImage()
    Description: Add an adaptive blur filter to the image.
    Example:

    $image->adaptiveBlurImage(5, 3);
    // Output: (applies an adaptive blur with specified radius and sigma)

    Imagick::adaptiveResizeImage()
    Description: Resize the image according to specific dimensions.
    Example:

    $image->adaptiveResizeImage(200, 300);
    // Output: (resizes image to 200x300 pixels)

    Imagick::adaptiveSharpenImage()
    Description: Sharpen an image adaptively based on intensity.
    Example:

    $image->adaptiveThresholdImage(3, 3, 1);
    // Output: (applies adaptive threshold for localized pixel intensity control)

    Imagick::adaptiveThresholdImage()
    Description: Applies a threshold based on local intensity values.
    Example:

    $image->adaptiveThresholdImage(3, 3, 1);
    // Output: (applies adaptive threshold for localized pixel intensity control)

    Imagick::addImage()
    Description: Add a new image to the Imagick object image list.
    Example:

    $image->addImage($newImage);
    // Output: (adds $newImage to the Imagick list)

    Imagick::addNoiseImage()
    Description: Add noise to the image for texture or effect.
    Example:

    $image->addNoiseImage(Imagick::NOISE_IMPULSE);
    // Output: (applies impulse noise effect)

    Imagick::annotateImage()
    Description: Add text annotation to the image.
    Example:

    $combinedImage = $image->appendImages(true);
    // Output: (appends images vertically)

    Imagick::appendImages()
    Description: Append multiple images vertically or horizontally.
    Example:

    Single-line comment example!

    Imagick::autoLevelImage()
    Description: Automatically adjust image levels.
    Example:

    $image->autoLevelImage();
    // Output: (adjusts levels for better brightness and contrast)

    Imagick::blackThresholdImage()
    Description: Convert pixels below a threshold to black.
    Example:

    $image->blackThresholdImage('#222222');
    // Output: (sets pixels darker than the color threshold to black)

    Imagick::blueShiftImage()
    Description: Applies a moonlit or nighttime effect.
    Example:

    $image->blueShiftImage(1.5);
    // Output: (adds a blue shift effect with specified intensity)

    Imagick::blurImage()
    Description: Apply a basic blur effect to the image.
    Example:

    $image->blurImage(5, 3);
    // Output: (adds blur with specified radius and sigma)

    Imagick::borderImage()
    Description: Add a border to the image.
    Example:

    $image->borderImage('black', 5, 5);
    // Output: (adds a 5-pixel black border)

    Imagick::brightnessContrastImage()
    Description: Adjust brightness and contrast of the image.
    Example:

    $image->brightnessContrastImage(20, 30);
    // Output: (adjusts brightness by 20 and contrast by 30)

    Imagick::charcoalImage()
    Description: Simulate a charcoal sketch effect.
    Example:

    $image->charcoalImage(1, 2);
    // Output: (applies charcoal effect)

    Imagick::chopImage()
    Description: Crop and trim a specific region of the image.
    Example:

    $image->chopImage(100, 100, 50, 50);
    // Output: (removes 100x100 area at specified position)

    Imagick::commentImage()
    Description: Add a comment to the image.
    Example:

    $image->commentImage("Sample Comment");
    // Output: (adds 'Sample Comment' metadata to the image)

    Imagick::convolveImage()
    Description: Apply a custom convolution kernel to the image.
    Example:

    $image->convolveImage(array(1, 2, 1, 2, 4, 2, 1, 2, 1));
    // Output: (applies the specified convolution filter)

    Imagick::cropImage()
    Description: Crop the image to a specified region.
    Example:

    $image->cropImage(100, 100, 10, 10);
    // Output: (crops 100x100 pixels starting from (10, 10))

    Imagick::despeckleImage()
    Description: Reduce speckle noise in the image.
    Example:

    $image->despeckleImage();
    // Output: (applies despeckle filter to reduce noise)

    Imagick::displayImage()
    Description: Display the image object.
    Example:

    $image->displayImage();
    // Output: (opens image in default viewer, if available)

    Imagick::distortImage()
    Description: Distort an image using specific distortion methods.
    Example:

    $image->distortImage(Imagick::DISTORTION_PERSPECTIVE, array(0,0, 30,60, 120,60, 150,120), true);
    // Output: (applies perspective distortion)

    Imagick::edgeImage()
    Description: Enhance the edges within the image.
    Example:

    $image->edgeImage(1);
    // Output: (enhances edges with specified radius)

    Imagick::embossImage()
    Description: Apply a grayscale emboss effect.
    Example:

    $image->embossImage(1, 1);
    // Output: (adds emboss effect)

    Imagick::enhanceImage()
    Description: Improve the quality of a noisy image.
    Example:

    $image->enhanceImage();
    // Output: (enhances image by reducing noise)

    Imagick::equalizeImage()
    Description: Equalize the histogram of the image.
    Example:

    $image->equalizeImage();
    // Output: (equalizes the image contrast)

    Imagick::extentImage()
    Description: Set the size and origin of the image.
    Example:

    $image->extentImage(200, 200, -10, -10);
    // Output: (resizes image with new origin offset)

    Imagick::flattenImages()
    Description: Merge the sequence of images into one.
    Example:

    $flattenedImage = $image->flattenImages();
    // Output: (flattens multiple layers into a single image)

    Imagick::flipImage()
    Description: Create a vertically flipped image.
    Example:

    $image->flipImage();
    // Output: (flips the image vertically)

    Imagick::flopImage()
    Description: Create a horizontally flipped image
    Example:

    $image->flopImage();
    // Output: (flips the image horizontally)

    Imagick::gammaImage()
    Description: Apply gamma correction to the image.
    Example:

    $image->gammaImage(1.2);
    // Output: (adjusts gamma to 1.2)

    Imagick::getCopyright()
    Description: Return ImageMagick API copyright.
    Example:

    echo $image->getCopyright();
    // Output: (displays ImageMagick copyright)

    Imagick::getImageBluePrimary()
    Description: Get the chromaticity blue primary point.
    Example:

    print_r($image->getImageBluePrimary());
    // Output: (displays x, y values for blue primary)

    Imagick::getImageColors()
    Description: Get the number of unique colors in the image.
    Example:

    echo $image->getImageColors();
    // Output: (number of unique colors)

    Imagick::getImageColorspace()
    Description: Get the colorspace of the image.
    Example:

    echo $image->getImageColorspace();
    // Output: (colorspace type)

    Imagick::getImageChannelDepth()
    Description: Get the depth of a specific image channel.
    Example:

    echo $image->getImageChannelDepth(Imagick::CHANNEL_RED);
    // Output: (depth of the red channel)

    Imagick::getImageDepth()
    Description: Get the image depth.
    Example:

    echo $image->getImageDepth();
    // Output: (bit-depth of the image)

    Imagick::getImageFormat()
    Description: Get the format of the image.
    Example:

    echo $image->getImageFormat();
    // Output: (file format, e.g., PNG)

    Imagick::getImageGeometry()
    Description: Get width and height of the image.
    Example:

    print_r($image->getImageGeometry());
    // Output: (width and height as an associative array)

    Imagick::getImageHeight()
    Description: Get the height of the image.
    Example:

    echo $image->getImageHeight();
    // Output: (height in pixels)

    Imagick::getImageWidth()
    Description: Get the width of the image.
    Example:

    echo $image->getImageWidth();
    // Output: (width in pixels)

    Imagick::haldClutImage()
    Description: Replace colors in the image using a Hald lookup table.
    Example:

    $image->haldClutImage($clutImage);
    // Output: (replaces colors based on Hald lookup table)

    Imagick::identifyImage()
    Description: Identify an image and return its attributes.
    Example:

    print_r($image->identifyImage());
    // Output: (image metadata and attributes)

    Imagick::magnifyImage()
    Description: Scale the image up by 2x.
    Example:

    $image->magnifyImage();
    // Output: (image size increased by 2x)

    Imagick::modulateImage()
    Description: Adjust brightness, saturation, and hue.
    Example:

    $image->modulateImage(100, 150, 100);
    // Output: (adjusts brightness, saturation, and hue)

    Imagick::motionBlurImage()
    Description: Simulate motion blur in the image.
    Example:

    $image->motionBlurImage(5, 10, 45);
    // Output: (applies motion blur with specified angle)

    Imagick::negateImage()
    Description: Invert the colors of the image.
    Example:

    $image->negateImage(false);
    // Output: (inverts colors)

    Imagick::newImage()
    Description: Create a new image.
    Example:

    $image->newImage(200, 200, new ImagickPixel('red'));
    // Output: (creates a 200x200 red image)

    Imagick::normalizeImage()
    Description: Enhance the contrast by adjusting colors to span the full color range.
    Example:

    $image->normalizeImage();
    // Output: (adjusts contrast across colors)

    Imagick::oilPaintImage()
    Description: Simulate an oil painting effect.
    Example:

    $image->oilPaintImage(3);
    // Output: (applies oil paint effect with radius 3)

    Imagick::orderedPosterizeImage()
    Description: Apply ordered dithering for posterization.
    Example:

    $image->orderedPosterizeImage("o8x8");
    // Output: (reduces colors using dithering)

    Imagick::posterizeImage()
    Description: Reduce image colors to limited levels.
    Example:

    $image->posterizeImage(4, false);
    // Output: (reduces color levels to 4)

    Imagick::queryFonts()
    Description: Get the list of available fonts.
    Example:

    print_r($image->queryFonts());
    // Output: (array of font names)

    Imagick::radialBlurImage()
    Description: Apply radial blur to the image.
    Example:

    $image->radialBlurImage(5);
    // Output: (adds radial blur with 5 degrees)

    Imagick::raiseImage()
    Description: Create a 3D button effect by lightening edges.
    Example:

    $image->raiseImage(10, 10, 5, 5, true);
    // Output: (creates raised edge effect)

    Imagick::randomThresholdImage()
    Description: Change pixel values based on intensity.
    Example:

    $image->randomThresholdImage(0.4 * Imagick::getQuantum(), 0.8 * Imagick::getQuantum());
    // Output: (adjusts pixel values based on intensity threshold)

    Imagick::readImageBlob()
    Description: Read an image from a binary string.
    Example:

    $image->readImageBlob(file_get_contents("path/to/image.png"));
    // Output: (loads image from binary data)

    Imagick::recolorImage()
    Description: Apply color transformations.
    Example:

    $image->recolorImage(array(
        1.5, 0, 0,
        0, 1.2, 0,
        0, 0, 1.3
    ));
    // Output: (adjusts RGB color intensities)

    Imagick::reduceNoiseImage()
    Description: Reduce noise in an image.
    Example:

    $image->reduceNoiseImage(1);
    // Output: (smooths contours and reduces noise)

    Imagick::resampleImage()
    Description: Resample the image to a desired resolution.
    Example:

    $image->resampleImage(150, 150, Imagick::FILTER_LANCZOS, 1);
    // Output: (resamples to 150x150 dpi)

    Imagick::rollImage()
    Description: Roll image pixels horizontally and vertically.
    Example:

    $image->rollImage(10, 10);
    // Output: (shifts image by 10 pixels horizontally and vertically)

    Imagick::rotationalBlurImage()
    Description: Apply rotational blur at a given angle.
    Example:

    $image->rotationalBlurImage(10);
    // Output: (applies 10-degree rotational blur)

    Imagick::rotateImage()
    Description: Rotate the image by a specified angle.
    Example:

    $image->rotateImage(new ImagickPixel('white'), 45);
    // Output: (rotates image by 45 degrees, filling gaps with white)

    Imagick::textureImage()
    Description: Tile a texture over the image.
    Example:

    $image->textureImage($textureImage);
    // Output: (tiles $textureImage as a background)

    Imagick::thumbnailImage()
    Description: Resize the image to thumbnail dimensions.
    Example:

    $image->thumbnailImage(100, 100);
    // Output: (creates 100x100 thumbnail)

    Imagick::thresholdImage()
    Description: Change pixel values based on threshold.
    Example:

    $image->thresholdImage(0.5 * Imagick::getQuantum());
    // Output: (pixels below threshold set to black, others white)

    Imagick::transformImage()
    Description: Crop and resize the image according to geometry.
    Example:

    $image->transformImage("100x100", "200x200");
    // Output: (crops to 100x100 and resizes to 200x200)

    Imagick::transformImageColorspace()
    Description: Convert the image to a different colorspace.
    Example:

    $image->transformImageColorspace(Imagick::COLORSPACE_GRAY);
    // Output: (converts image to grayscale)

    Imagick::transposeImage()
    Description: Create a vertically mirrored image.
    Example:

    $image->transposeImage();
    // Output: (vertical mirror effect)

    Imagick::transverseImage()
    Description: Create a horizontally mirrored image.
    Example:

    $image->transverseImage();
    // Output: (horizontal mirror effect)

    Imagick::trimImage()
    Description: Trim edges of the image.
    Example:

    $image->trimImage(0);
    // Output: (trims edges with matching colors)

    Imagick::setImageChannelDepth()
    Description: Set channel depth for a specific channel.
    Example:

    $image->setImageChannelDepth(Imagick::CHANNEL_RED, 16);
    // Output: (sets red channel depth to 16 bits)

    Imagick::setImageOpacity()
    Description: Set the opacity level of the image.
    Example:

    $image->setImageOpacity(0.5);
    // Output: (sets opacity to 50%)

    Imagick::sharpenImage()
    Description: Sharpen the image with a radius and sigma.
    Example:

    $image->sharpenImage(2, 1);
    // Output: (sharpens with 2 radius and 1 sigma)

    Imagick::shaveImage()
    Description: Shave pixels off edges of the image.
    Example:

    $image->shaveImage(10, 10);
    // Output: (removes 10 pixels from each edge)

    Imagick::shearImage()
    Description: Apply a shear transformation to the image.
    Example:

    $image->shearImage(new ImagickPixel('white'), 20, 30);
    // Output: (shears image by 20x30 degrees)

    Imagick::sketchImage()
    Description: Simulate a pencil sketch effect.
    Example:

    $image->sketchImage(10, 1, 45);
    // Output: (applies sketch effect with given radius, sigma, and angle)

    Imagick::solarizeImage()
    Description: Apply a solarizing effect.
    Example:

    $image->solarizeImage(128);
    // Output: (solarizes using a threshold of 128)

    Imagick::spliceImage()
    Description: Splice a solid color into the image.
    Example:

    $image->spliceImage(10, 10, 5, 5);
    // Output: (adds a 10x10 section at coordinates 5,5)

    Imagick::spreadImage()
    Description: Randomly displace each pixel in a block.
    Example:

    $image->spreadImage(5);
    // Output: (randomly displaces pixels with a 5-pixel radius)

    Imagick::unsharpMaskImage()
    Description: Apply an unsharp mask filter.
    Example:

    $image->unsharpMaskImage(1, 0.5, 1, 0.05);
    // Output: (sharpens image with unsharp mask)

    Imagick::uniqueImageColors()
    Description: Discard duplicate colors in the image.
    Example:

    $image->uniqueImageColors();
    // Output: (removes duplicated colors)

    Imagick::vignetteImage()
    Description: Add a vignette effect to the image.
    Example:

    $image->vignetteImage(10, 20, 5, 5);
    // Output: (adds vignette with given parameters)

    Imagick::waveImage()
    Description: Apply a wave filter to the image.
    Example:

    $image->waveImage(5, 50);
    // Output: (creates a wave effect with amplitude 5, wavelength 50)

    Imagick::whiteThresholdImage()
    Description: Set pixels above threshold to white.
    Example:

    $image->whiteThresholdImage(new ImagickPixel('rgb(200, 200, 200)'));
    // Output: (pixels above threshold become white)

    Imagick::whiteThresholdImage()
    Description: Set pixels above threshold to white.
    Example:

    $image->whiteThresholdImage(new ImagickPixel('rgb(200, 200, 200)'));
    // Output: (pixels above threshold become white)

    Imagick::waveImage()
    Description: Apply a wave filter to the image.
    Example:

    $image->waveImage(5, 50);
    // Output: (creates a wave effect with amplitude 5, wavelength 50)

    Imagick::writeImage()
    Description: Write the image to a file.
    Example:

    $image->writeImage("output.png");
    // Output: (saves image to output.png)

    Imagick::getImageWidth()
    Description: Retrieve the width of the image.
    Example:

    echo $image->getImageWidth();
    // Output: (width of $image)

    Imagick::getImageHeight()
    Description: Retrieve the height of the image.
    Example:

    echo $image->getImageHeight();
    // Output: (height of $image)

    Imagick::getImageFormat()
    Description: Retrieve the format of the image.
    Example:

    echo $image->getImageFormat();
    // Output: (format of $image, e.g., PNG, JPEG)

    Imagick::getImageResolution()
    Description: Get the resolution of the image.
    Example:

    print_r($image->getImageResolution());
    // Output: (image resolution as [x, y] array)

    Imagick::setImageUnits()
    Description: Set the units of resolution for the image.
    Example:

    $image->setImageUnits(imagick::RESOLUTION_PIXELSPERINCH);
    // Output: (sets resolution units to pixels per inch)

    Imagick::shadeImage()
    Description: Apply a 3D effect to the image by shading.
    Example:

    $image->shadeImage(true, 30, 30);
    // Output: (adds 3D shading effect)
  • PHP Image Processing and GD Functions Complete Reference

    PHP Image Processing and GD Functions Complete Reference

    Image processing and GD functions enable the creation and manipulation of image files across various formats, such as GIF, PNG, JPEG, WBMP, and XPM. With PHP, these functions can directly output the image to the browser. The GD library is central to implementing image functions for this purpose, though other libraries may be needed depending on the image formats involved.

    Example: This demonstrates the use of the imagecolorclosesthwb() function in PHP.

    <?php
    
    // Create a new image from a given URL
    $image = imagecreatefromgif(
    'https://www.example.com/sample-image.gif');
    
    // Display the index of the color closest to the specified hue, white, and blackness
    echo 'Hue, White, and Blackness closest color index: '
    	. imagecolorclosesthwb($image, 120, 200, 50);
    
    imagedestroy($image);
    ?>

    Output:

    Hue, White, and Blackness closest color index: 42
    The list of Image processing and GD s are given below:

    gd_info()

    Description: Retrieve information about the installed GD library.

    Example:

    print_r(gd_info());
    // Output: (array of GD library information)

    getimagesize()

    Description: Get the dimensions of an image.

    Example:

    $size = getimagesize("example.jpg");
    print_r($size);
    // Output: (displays array with width, height, and more details)

    getimagesizefromstring()

    Description: Determine the size of an image from a binary string.

    Example:

    $imageData = file_get_contents("example.jpg");
    $size = getimagesizefromstring($imageData);
    print_r($size);
    // Output: (array of image size information)

    imagealphablending()

    Description: Set the blending mode for an image.

    Example:

    $image = imagecreatetruecolor(200, 200);
    imagealphablending($image, true);
    // Output: (enables or disables blending for $image)

    imagearc()

    Description: Create an arc centered at the specified coordinates.

    Example:

    $image = imagecreatetruecolor(200, 200);
    imagearc($image, 100, 100, 150, 150, 0, 180, 0xFFFFFF);
    // Output: (draws a half-circle in the image)

    imagechar()

    Description: Draw a character horizontally on an image.

    Example:

    imagechar($image, 5, 50, 50, "A", 0xFFFFFF);
    // Output: (draws 'A' at (50, 50) on $image)

    imagecharup()

    Description: Draw a character vertically on an image.

    Example:

    imagecharup($image, 5, 50, 50, "B", 0xFFFFFF);
    // Output: (draws 'B' vertically at (50, 50) on $image)

    imagecolorallocate()

    Description: Set a color in an image.

    Example:

    $color = imagecolorallocate($image, 0, 128, 255);
    // Output: (assigns a blue color to $image)

    imagecolorallocatealpha()

    Description: Allocate color with alpha for transparency.

    Example:

    $color = imagecolorallocatealpha($image, 255, 0, 0, 50);
    // Output: (assigns a semi-transparent red color)

    imagecolorat()

    Description: Get the color of a specific pixel.

    Example:

    $color = imagecolorat($image, 10, 10);
    echo $color;
    // Output: (color index of pixel at (10, 10))

    imagecolorclosest()

    Description: Find the closest color index in the image.

    Example:

    $color = imagecolorclosest($image, 100, 100, 200);
    echo $color;
    // Output: (closest color index for the specified RGB)

    imagecolorclosestalpha()

    Description: Get the closest color with an alpha value.

    Example:

    $color = imagecolorclosestalpha($image, 100, 100, 200, 50);
    echo $color;
    // Output: (closest color index with alpha)

    imagecolorclosesthwb()

    Description: Find the hue, white, and black closest color index.

    Example:

    $color = imagecolorclosesthwb($image, 255, 0, 0);
    echo $color;
    // Output: (closest index for hue, white, and black)

    imagecolorexact()

    Description: Get the index of a specific color in the image palette.

    Example:

    $color = imagecolorexact($image, 255, 255, 255);
    echo $color;
    // Output: (color index of exact match for white)

    imagecolormatch()

    Description: Match the palette version colors of an image to a true-color version.

    Example:

    imagecolormatch($image1, $image2);
    // Output: (matches colors of $image1 to $image2)

    imagecolorresolve()

    Description: Get the specified color or closest possible in the palette.

    Example:

    $color = imagecolorresolve($image, 255, 100, 50);
    echo $color;
    // Output: (index of exact or nearest color)

    imagecolorresolvealpha()

    Description: Find specified color and alpha value or closest alternative.

    Example:

    $color = imagecolorresolvealpha($image, 255, 100, 50, 50);
    echo $color;
    // Output: (index of color with alpha)

    imagecolorset()

    Description: Set the color for a specified palette index.

    Example:

    imagecolorset($image, 5, 100, 50, 150);
    // Output: (sets color at index 5 in palette)

    imagecolorsforindex()

    Description: Get the colors at a specified index.

    Example:

    $color = imagecolorsforindex($image, 5);
    print_r($color);
    // Output: (RGB array of colors at index 5)

    imagecolorstotal()

    Description: Find the number of colors in an image’s palette.

    Example:

    echo imagecolorstotal($image);
    // Output: (total number of colors in the palette)

    imagecolortransparent()

    Description: Define a color as transparent in the image.

    Example:

    imagecolortransparent($image, $color);
    // Output: (sets $color as transparent)

    imageconvolution()

    Description: Apply a convolution matrix to the image.

    Example:

    $matrix = array(
      array(0, -1, 0),
      array(-1, 4, -1),
      array(0, -1, 0)
    );
    imageconvolution($image, $matrix, 1, 127);
    // Output: (applies convolution effect)

    imagecopy()

    Description: Copy all or part of an image.

    Example:

    imagecopy($image, $src, 0, 0, 0, 0, 100, 100);
    // Output: (copies $src onto $image)

    imagecopymerge()

    Description: Copy and merge an image with transparency.

    Example:

    imagecopymerge($image, $src, 0, 0, 0, 0, 100, 100, 50);
    // Output: (merges $src onto $image with 50% opacity)

    imagecopymergegray()

    Description: Merge a grayscale version of part of an image.

    Example:

    echo IntlChar::isspace(" ");
    // Output: 1

    imagecreate()

    Description: Create a new palette-based image.

    Example:

    $image = imagecreate(200, 200);
    // Output: (creates 200x200 image with color palette)

    imagecreatetruecolor()

    Description: Create a new true-color image.

    Example:

    $image = imagecreatetruecolor(200, 200);
    // Output: (creates 200x200 true-color image)

    imagecrop()

    Description: Crop the image to a specified rectangle.

    Example:

    $image = imagecrop($image, array("x"=>50, "y"=>50, "width"=>100, "height"=>100));
    // Output: (crops $image to the given dimensions)

    imagedashedline()

    Description: Draw a dashed line in the image.

    Example:

    imagedashedline($image, 0, 0, 200, 200, 0xFFFFFF);
    // Output: (draws dashed line from (0, 0) to (200, 200))

    imagefilledarc()

    Description: Draw a filled partial arc.

    Example:

    imagefilledarc($image, 100, 100, 100, 100, 0, 180, 0x0000FF, IMG_ARC_PIE);
    // Output: (draws a half-circle arc filled in blue)

    imagefilledrectangle()

    Description: Draw a filled rectangle.

    Example:

    imagefilledrectangle($image, 0, 0, 100, 50, 0x000000);
    // Output: (draws black rectangle at specified area)

    imagefilledarc()

    Description: Draw a filled partial arc.

    Example:

    imagefilledarc($image, 100, 100, 100, 100, 0, 180, 0x0000FF, IMG_ARC_PIE);
    // Output: (draws a half-circle arc filled in blue)

    imagelayereffect()

    Description: Set alpha blending flag for layering effects.

    Example:

    imagelayereffect($image, IMG_EFFECT_OVERLAY);
    // Output: (enables overlay effect on $image)

    imagepolygon()

    Description: Draw a polygon on the image.

    Example:

    $points = array(50, 0, 100, 100, 0, 100);
    imagepolygon($image, $points, 3, 0xFFFFFF);
    // Output: (draws white triangle)

    imagerectangle()

    Description: Draw a rectangle in the image.

    Example:

    imagerectangle($image, 10, 10, 100, 50, 0xFF0000);
    // Output: (draws red rectangle at specified area)

    imagetruecolortopalette()

    Description: Convert a true-color image to a palette image.

    Example:

    imagetruecolortopalette($image, false, 256);
    // Output: (converts image to 256 color palette)

    imagesy()

    Description: Return the height of an image.

    Example:

    echo imagesy($image);
    // Output: (height of $image)

    imagesx()

    Description: Return the width of an image.

    Example:

    echo imagesx($image);
    // Output: (width of $image)
  • PHP IntlChar Functions

    The IntlChar class in PHP provides a set of static methods for character processing, conforming to the Unicode standard.

    IntlChar::charAge(): Get the Unicode version in which the code point was first designated.

    IntlChar::charAge(int $codepoint): array;

    IntlChar::charDigitValue(): Get the decimal digit value of a code point.

    IntlChar::charDigitValue(int $codepoint): int;

    IntlChar::charDirection(): Get the bidirectional category value for a code point.

    IntlChar::charDirection(int $codepoint): int;

    IntlChar::charFromName(): Find a Unicode character by its name.

    IntlChar::charFromName(string $name, int $nameChoice = IntlChar::UNICODE_CHAR_NAME): int;

    IntlChar::charMirror(): Get the “mirror image” of a code point.

    IntlChar::charMirror(int $codepoint): int;

    IntlChar::charName(): Get the Unicode name for a code point.

    IntlChar::charName(int $codepoint, int $nameChoice = IntlChar::UNICODE_CHAR_NAME): string;

    IntlChar::charScript(): Get the script value for a code point.

    IntlChar::charScript(int $codepoint): int;

    IntlChar::charType(): Get the general category value for a code point.

    IntlChar::charType(int $codepoint): int;

    IntlChar::digit(): Get the decimal digit value of a numeric code point.

    disk_free_space($directory);

    IntlChar::enumCharNames(): Enumerate all assigned Unicode character names.

    IntlChar::enumCharNames(int $start, int $end, callable $callback, int $nameChoice = IntlChar::UNICODE_CHAR_NAME);

    IntlChar::enumCharTypes(): Enumerate all code points with the same general category.

    IntlChar::enumCharTypes(callable $callback);

    IntlChar::foldCase(): Perform Unicode simple case folding.

    IntlChar::foldCase(int $codepoint, int $options = IntlChar::FOLD_CASE_DEFAULT): int;

    IntlChar::forDigit(): Get the numeric value of a Unicode digit.

    IntlChar::forDigit(int $digit, int $radix = 10): int;

    IntlChar::getBidiPairedBracket(): Get the paired bracket character for a code point.

    IntlChar::getBidiPairedBracket(int $codepoint): int;

    IntlChar::getBlockCode(): Get the Unicode block value for a code point.

    IntlChar::getBlockCode(int $codepoint): int;

    IntlChar::getCombiningClass(): Get the combining class value for a code point.

    IntlChar::getCombiningClass(int $codepoint): int;

    IntlChar::getFC_NFKC_Closure(): Get the FC_NFKC_Closure property value for a code point.

    IntlChar::getFC_NFKC_Closure(int $codepoint): string;

    IntlChar::getIntPropertyMaxValue(): Get the maximum value for a Unicode property.

    IntlChar::getIntPropertyMaxValue(int $property): int;

    IntlChar::getIntPropertyMinValue(): Get the minimum value for a Unicode property.

    IntlChar::getIntPropertyMinValue(int $property): int;

    IntlChar::getIntPropertyValue(): Get the integer value for a Unicode property.

    IntlChar::getIntPropertyValue(int $codepoint, int $property): int;

    IntlChar::getNumericValue(): Get the numeric value for a code point.

    IntlChar::getNumericValue(int $codepoint): float;

    IntlChar::getPropertyEnum(): Get the integer value for a property alias.

    IntlChar::getPropertyEnum(string $alias): int;

    IntlChar::getPropertyName(): Get the property name for a property value.

    IntlChar::getPropertyName(int $property, int $nameChoice = IntlChar::LONG_PROPERTY_NAME): string;

    IntlChar::getPropertyValueName(): Get the name for a property value.

    IntlChar::getPropertyValueName(int $property, int $value, int $nameChoice = IntlChar::LONG_PROPERTY_NAME): string;

    IntlChar::getUnicodeVersion(): Get the Unicode version.

    IntlChar::getUnicodeVersion(): array;

    IntlChar::hasBinaryProperty(): Check if a code point has a binary property.

    IntlChar::hasBinaryProperty(int $codepoint, int $property): bool;

    IntlChar::hasBinaryProperty(): Check if a code point has a binary property.

    IntlChar::hasBinaryProperty(int $codepoint, int $property): bool;

    IntlChar::isalnum(): Check if a code point is an alphanumeric character.

    IntlChar::isalnum(int $codepoint): bool;

    IntlChar::isalpha(): Check if a code point is an alphabetic character.

    IntlChar::isalpha(int $codepoint): bool;

    IntlChar::isbase(): Check if a code point is a base character.

    IntlChar::isbase(int $codepoint): bool;

    IntlChar::isblank(): Check if a code point is a blank character.

    IntlChar::isblank(int $codepoint): bool;

    IntlChar::iscntrl(): Check if a code point is a control character.

    IntlChar::iscntrl(int $codepoint): bool;

    IntlChar::isdefined(): Check if a code point is a defined character.

    IntlChar::isdefined(int $codepoint): bool;

    IntlChar::isdigit(): Check if a code point is a digit character.

    IntlChar::isdigit(int $codepoint): bool;

    fileowner($filename);

    fileowner($filename);

    IntlChar::isgraph(): Check if a code point is a graphic character.

    IntlChar::isgraph(int $codepoint): bool;

    IntlChar::isgraph(int $codepoint): bool;

    IntlChar::isgraph(int $codepoint): bool;

    IntlChar::isIDIgnorable(): Check if a code point is an ignorable character.

    IntlChar::isIDIgnorable(int $codepoint): bool;

    IntlChar::isIDPart(): Check if a code point can be part of an identifier.

    IntlChar::isIDPart(int $codepoint): bool;

    fnmatch(): Matches a filename or string against a specified pattern.

    fnmatch($pattern, $string, $flags);

    IntlChar::isIDStart(): Check if a code point can start an identifier.

    IntlChar::isIDStart(int $codepoint): bool;

    IntlChar::isISOControl(): Check if a code point is an ISO control character.

    IntlChar::isISOControl(int $codepoint): bool;

    IntlChar::islower(): Check if a code point is a lowercase character.

    IntlChar::islower(int $codepoint): bool;

    IntlChar::islower(int $codepoint): bool

    IntlChar::islower(int $codepoint): bool;

    IntlChar::isMirrored(): Check if a code point has the Bidi_Mirrored property.

    IntlChar::isMirrored(int $codepoint): bool;

    IntlChar::isprint(): Check if a code point is a printable character.

    fseek($handle, $offset, $whence);

    IntlChar::ispunct(): Check if a code point is a punctuation character.

    IntlChar::ispunct(int $codepoint): bool;

    IntlChar::isspace(): Check if a code point is a space character.

    IntlChar::isspace(int $codepoint): bool;

    IntlChar::isUWhiteSpace(): Check if a code point has the White_Space property.

    IntlChar::isUWhiteSpace(int $codepoint): bool;