Documentation

functions.php

This file demonstrates the central functions.

Tags
file-name

:functions.php

author

:Deepika Patel deepika.patel@ucertify.com

create_on

:30-March-2018

last_update_on

:12 July 2020

Interfaces, Classes, Traits and Enums

clsXml_Array
This is the function that has been used for xml conversion to array.
FRIENDLY_GUID_TYPE
clsVisiblity
This class is used for cls visibility.
EncryptionManager
This class is used for encryption decryption.

Table of Contents

isValidEmail()  : mixed
Check if an email address is valid.
checkPhoneNo()  : int
Check if the given string is a valid phone number.
sanitizeEmail()  : string
Sanitize an email address.
sanitizeString()  : string
Sanitizes a string by removing multiple spaces, stripping tags, and escaping special characters.
gen_uuid()  : string
Generates a UUID / unique ID of specified length
getUserRequest()  : array<string|int, mixed>
Retrieves user request data from $_GET and $_POST.
datediff()  : string
It is the function that has been to find difference between two dates in diffrent units like month,year and days.
strIntoComma()  : string
Converts a string into a comma-separated list of values, removing extra spaces and newlines.
getDatesListFromRange()  : array<string|int, mixed>
Generates a list of dates between a given start and end date.
xml2array()  : array<string|int, mixed>
Convert an XML string to a nested array.
xmltoArray()  : array<string|int, mixed>
This function that is used to convert xml into array.
array2xml()  : string
This function has been used to convert array to xml.
short_string()  : string
Shorten a string to a specified length.
findtext()  : string
Find a substring within a string between two given substrings and update the starting index.
findtextnew()  : string
This function has been used to find text (new function : to find between substrings).
getAttribute()  : string
Extracts the value of the specified attribute from an HTML/XML tag.
removecomments()  : string
Remove comments and specific tags from a string.
removephrase()  : string
Removes a specified phrase from a given string.
getSmartyTemplate()  : object
Find and get the Smarty template or retrieves an instance of the Smarty template engine with appropriate settings and assigns common global variables.
strtodate()  : string
Converts a date string to the format 'mm/dd/yyyy'.
datetostr()  : string
Converts a date string in the format MM/DD/YYYY to a string in the format YYYYMMDD000000.
dayafter()  : string
This function has been used to convert date.
f_random()  : string
Generates a random string with specified length and type.
redirect_header()  : void
Redirects to a given URL with an optional message and delay time.
f_date()  : string
Format date in given format
trimWhiteSpace()  : string
Trims whitespace characters from the beginning and end of a string.
removeCDATA()  : string
Removes CDATA tags from a given string
validXMLChr()  : string
Removes invalid characters from XML content.
removeHighAscii()  : string
Removes high ASCII characters from the input string and replaces them with spaces.
remfiles()  : bool
Deletes all files in the given directory that match the specified pattern.
writeFile()  : bool
Write data to a file
uc_unique()  : string
This function has been used to return unique number.
GUID64_encode()  : string
Encodes an integer using base 64 and returns a string of a specified size.
GUID64_decode()  : int
Decodes a base-64 encoded GUID string into a decimal number.
uc_unique_rev()  : mixed
This function has been used to reverse unique no.. Decode a unique string generated with uc_unique.
dec2string()  : string|false
Converts a decimal number to a string representation in the given base.
string2dec()  : string|false
Convert a string in a given base to a decimal number.
getMicroTime()  : float
Returns the current Unix timestamp with microseconds
getTimeByTimezone()  : string
Returns the current time in the specified time zone.
setAssessmentDateTime()  : string
Sets the assessment date and time based on a specified timezone option.
getEndDate()  : string
Get the end date based on the start date, end date or number of days.
isDatePassed()  : bool
Check if the given date has already passed based on the given timezone.
joinPaths()  : string
This is the function that has been used to join paths.
addProtocol()  : string
Add a protocol to a URL if it does not already have one.
rprint_r()  : array<string|int, mixed>
Recursive version of print_r that returns the result as an associative array.
__ucd()  : void
Outputs the given variable for debugging purposes only if the server name is 'localhost'.
str2Assoc()  : array<string|int, mixed>
Convert a string to an associative array
ucIsset()  : bool
Check if a variable is set and not empty, and optionally compare it to a given value.
ucInStr()  : bool
This is the function that has been used to return haystack.
ucTblStr()  : string
Create a table row from an array of data.
ucItemsByArray()  : array<string|int, mixed>
This is the function that has been used to return array by uc items.
get_string_between()  : string
Returns a string between two delimiters in a larger string.
ucArrayByItem()  : array<string|int, mixed>
Return an associative array indexed by a specific item in a nested array.
strToHex()  : string
Convert a string to its hexadecimal representation.
hex2bin()  : string
Converts a hexadecimal string to its binary representation.
generateAuthToken()  : string
Generates an authentication token using AES-256-CBC encryption.
extractAuthToken()  : string|null
Extracts a string from an encrypted token generated using generateAuthToken function.
array_merge_uc()  : array<string|int, mixed>
Merge two arrays, optionally recursively.
array_keys_uc()  : array<string|int, mixed>
Returns all the keys or specific keys of an array, optionally filtered by value.
array_unique_uc()  : array<string|int, mixed>
Removes duplicate values from an array.
count_uc()  : int
Counts the number of elements in an array.
array_change_key_uc()  : array<string|int, mixed>
Returns a new array with the keys changed to the value of the specified key in the original array
multi_array_sort()  : mixed
Sorts a multidimensional array by a specified key
obfuscate_link()  : string
Obfuscates a given link by encoding it using base64 and rawurlencode.
unobfuscate_link()  : string
Converts a number of seconds into a human-readable string
seconds2human()  : string
This is the function that has been used to convert seconds to human.
friendlyDate()  : string
Returns a human-readable string representing the time elapsed since the provided timestamp
formatISBN()  : string
Format a given ISBN number into a standard format with hyphens.
addToArchive()  : void
Adds files from a directory to a ZIP archive.
dateafter()  : string
Returns the date after a specified number of days after a given date.
timezoneDoesDST()  : bool|int
Check if the given timezone observes Daylight Saving Time (DST).
get_time_difference()  : string
Calculates the time difference between two time values
convertToUTC()  : int
Convert a given time to UTC time
generateAccessToken()  : array<string|int, mixed>
Generates an access token for a client with the given ID and email.
verifyAccessToken()  : string
Verify the access token using JWT decode
refreshAccessToken()  : object|bool
This is the function that has been used to refresh access token.
friendlyguid()  : string
Converts a GUID to a more friendly format by replacing confusing characters.
getUserIP()  : string
Get the user's IP address.
array_column_uc()  : array<string|int, mixed>
This is the function that has been used to get columns of array.
bin2ip()  : string
This is the function that has been used to get bin from IP.
removeStrSpace()  : string
Removes whitespace characters from a string.
json_validate()  : mixed
Validate a JSON string and return the decoded result.
resizeImage()  : void
Resize an image and save it to the specified path.
uf_findkey()  : string
Find the key from a string
utf8json()  : string
Encode an array to UTF-8 encoded JSON string
getContentsGUIDs()  : mixed
Function to get contentGUIDs based on filters
getDisabledGuids()  : array<string|int, mixed>
Remove elements from an array based on keys present in another array.
removeInvisible()  : array<string|int, mixed>
This function eliminate invisible guids from the question list
delete_from_coverage()  : array<string|int, mixed>
Deletes a given content GUID from a coverage array.
setAnswerSeq()  : array<string|int, mixed>
Sets answer sequence for an array of answers.
getAnswerSeqStr()  : array<string|int, mixed>
Returns the answer sequence string based on the given parameters.
get_grade_formula_default()  : string|array<string|int, mixed>
Get the default grade formula in a JSON-encoded string or as an array
get_grade_scale_default()  : string|array<string|int, mixed>
Returns the default grade scale as a JSON string or array.
get_course_config_default()  : mixed
It is the function that has been used to get default config detail.
get_coverage_default()  : string
Returns the default coverage for a course, in JSON format.
getTestName()  : string
Returns the name of a test based on its type and optional details.
zfill()  : string
Pads the given number with leading zeros until it reaches the given length.
get_range()  : mixed
Returns a value within a specific range, or a default value if not set
get_default()  : mixed
Returns a default value if the primary value is empty, else returns the primary value.
replaceconst()  : string
Replaces constants in a string with their corresponding values.
replaceimage()  : string
Replaces images in a string with secure URLs, if necessary.
replacelinebreak()  : string
Replace line break tags and syntax tags with proper <pre> tags for syntax highlighting
byte2array()  : array<string|int, mixed>
Converts a byte to an array of bits, using a given default array as a template.
arrayFilterBasedOnKey()  : mixed
array2byte()  : string
This function is used to convert array into byte.
get_ddl_data_uc()  : array<string|int, mixed>
This function is used to get ddl data.
getFlashCardContentSubtypes()  : mixed
Get FlashCard content subtypes.
extractArray()  : array<string|int, mixed>
This function is used to extract array.
unsetArrayData()  : array<string|int, mixed>
This function is used to unset array data.
findexts()  : string|void
Returns the file extension of a given filename
get_file_extension()  : array<string|int, mixed>
Get the file extension and name from a file path.
getSeqList()  : array<string|int, mixed>
A function to Get Sequence List of Guid.
getOrderType()  : array<string|int, mixed>
This function is used to get order type.
calcPrice()  : array<string|int, mixed>
Calculate the net price and discount information based on the given data.
extractLicence()  : array<string|int, mixed>|string
Extracts license information from an array of licenses.
findtextnew_withouttrim()  : string|false
Searches for a string between two other strings in a given string
findContentImage()  : array<string|int, mixed>
This function is used to find content image.
findAssets()  : array<string|int, mixed>
It is the function that has been used to detect assets.
findSpanGuids()  : array<string|int, mixed>
Extracts GUIDs from <span> tags in the given string.
findDevices()  : array<string|int, mixed>
Find all device images in a string.
api_convert_test_session_options2array()  : array<string|int, mixed>
Convert test session options from integer to an associative array.
api_convert_test_session_array2options()  : int
Convert test session options array to binary format.
api_convert_assignment_schedule_options2array()  : array<string|int, mixed>
Convert an assignment schedule options integer to an associative array.
api_convert_assignment_schedule_array2options()  : array<string|int, mixed>
It is the function that has been used to convert test session array into options.
score2grade()  : string
A function for score to grade.
result2grade()  : array<string|int, mixed>
Converts a set of results to grades based on a given grade scale.
getCurrentOSFromServer()  : string
Returns the current operating system from the server.
json_encode_uc()  : string|false
Encode the given data as JSON with support for encoding Unicode characters
json_decode_uc()  : mixed
Decodes a JSON string and returns the resulting value.
rand_uc()  : int
Generate a random number within a given range.
strip_all_tags_uc()  : string
A function for to strip tags.
file_get_contents_uc()  : string|false
Read entire contents of a file into a string
debug_backtrace_uc()  : array<string|int, mixed>
A function for to get debug trace.
sanitize_title_with_dashes_uc()  : string
Sanitizes a title, replacing whitespace and a few other characters with dashes. * Limits the output to alphanumeric characters, underscore (_) and dash (-).
file_get_contents_curl()  : string
Retrieve the contents of a URL using cURL.
create_redis_key()  : string
Generates a Redis key using a given string value and prefix.
get_sys_mac_address()  : string|null
Retrieve the MAC address of the current system.
array_merge_preserve()  : array<string|int, mixed>
Merge arrays while preserving keys.
__ucc()  : mixed
This is the function that has been used to debug and print data in jigyaasa.
generateNewPassword()  : string
Generates a new random password.
getLMSPlatformIDFromURL()  : string
Returns the LMS platform ID based on the given URL.

Functions

isValidEmail()

Check if an email address is valid.

isValidEmail(string $email[, bool $ignore_number = false ]) : mixed
Parameters
$email : string

The email address to check.

$ignore_number : bool = false

Optional. Whether to ignore numbers or not. Default is false.

Return values
mixed

Returns the email address if valid, false otherwise.

checkPhoneNo()

Check if the given string is a valid phone number.

checkPhoneNo(string $str) : int
Parameters
$str : string

The phone number to be checked.

Return values
int

Returns 1 if the phone number is valid, otherwise returns 0.

sanitizeEmail()

Sanitize an email address.

sanitizeEmail(string $email) : string
Parameters
$email : string

The email address to be sanitized.

Return values
string

The sanitized email address.

sanitizeString()

Sanitizes a string by removing multiple spaces, stripping tags, and escaping special characters.

sanitizeString(string $str) : string
Parameters
$str : string

The string to be sanitized.

Return values
string

The sanitized string.

gen_uuid()

Generates a UUID / unique ID of specified length

gen_uuid([int $len = 8 ][, string $salt = 'ucertify' ]) : string
Parameters
$len : int = 8

The desired length of the ID (defaults to 8)

$salt : string = 'ucertify'

The salt to use for generating the ID (defaults to 'ucertify')

Return values
string

The generated unique ID

getUserRequest()

Retrieves user request data from $_GET and $_POST.

getUserRequest([array<string|int, mixed> $data = array() ][, bool $isStrip = true ]) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed> = array()

The data array to populate with request values.

$isStrip : bool = true

Whether to strip tags from request values or not (defaults to true).

Return values
array<string|int, mixed>

The populated data array.

datediff()

It is the function that has been to find difference between two dates in diffrent units like month,year and days.

datediff(string $interval, string $datefrom, string $dateto[, string $using_timestamps = false ]) : string
Parameters
$interval : string

denotes interval.

$datefrom : string

denotes datefrom.

$dateto : string

denotes dateto.

$using_timestamps : string = false

denotes using_timestamps.

Return values
string

as whole response of function.

strIntoComma()

Converts a string into a comma-separated list of values, removing extra spaces and newlines.

strIntoComma([string $str = '' ]) : string
Parameters
$str : string = ''

The string to convert.

Return values
string

The comma-separated list of values.

getDatesListFromRange()

Generates a list of dates between a given start and end date.

getDatesListFromRange(string $start, string $end[, string $format = 'Y-m-d' ]) : array<string|int, mixed>
Parameters
$start : string

Start date in 'Y-m-d' format

$end : string

End date in 'Y-m-d' format

$format : string = 'Y-m-d'

Date format for the output list, defaults to 'Y-m-d'

Return values
array<string|int, mixed>

List of dates between the start and end date

xml2array()

Convert an XML string to a nested array.

xml2array(string $xml) : array<string|int, mixed>
Parameters
$xml : string

The XML string to convert.

Return values
array<string|int, mixed>

The resulting nested array.

xmltoArray()

This function that is used to convert xml into array.

xmltoArray(string $xml) : array<string|int, mixed>
Parameters
$xml : string

denotes xml string.

Return values
array<string|int, mixed>

as response of the function.

array2xml()

This function has been used to convert array to xml.

array2xml(string $mainTag, string $ary[, string $id = '' ]) : string
Parameters
$mainTag : string

denotes mainTag.

$ary : string

denotes ary.

$id : string = ''

is the id.

Return values
string

as overall response of the function.

short_string()

Shorten a string to a specified length.

short_string(string $str[, int $length = 80 ], int $direction[, bool $remove_single_quote = true ]) : string
Parameters
$str : string

The string to shorten.

$length : int = 80

The maximum length of the shortened string.

$direction : int

The direction from which to shorten the string. 1 for left, 2 for right, 0 for both sides.

$remove_single_quote : bool = true

Whether or not to remove single quotes from the string.

Return values
string

The shortened string.

findtext()

Find a substring within a string between two given substrings and update the starting index.

findtext(string $str, string $fstr, string $lstr, string $i) : string
Parameters
$str : string

denotes str.

$fstr : string

denotes fstr.

$lstr : string

is the lstr.

$i : string

is the i.

Return values
string

as overall response of the function.

findtextnew()

This function has been used to find text (new function : to find between substrings).

findtextnew(string $str, string $fstr, string $lstr, string &$i) : string
Parameters
$str : string

denotes str.

$fstr : string

denotes fstr.

$lstr : string

is the lstr.

$i : string

is the i.

Return values
string

as overall response of the function.

getAttribute()

Extracts the value of the specified attribute from an HTML/XML tag.

getAttribute(string $strmle, string $tag, string $attribute, int &$i) : string
Parameters
$strmle : string

The input string containing the tag.

$tag : string

The name of the tag to extract the attribute from.

$attribute : string

The name of the attribute to extract.

$i : int

The index to start searching for the tag.

Return values
string

The value of the specified attribute, or an empty string if the attribute is not found.

removecomments()

Remove comments and specific tags from a string.

removecomments(string $str) : string
Parameters
$str : string

The input string.

Return values
string

The modified string.

removephrase()

Removes a specified phrase from a given string.

removephrase(string $str, string $keystart, string $keyend) : string
Parameters
$str : string

The string to remove the phrase from.

$keystart : string

The starting phrase to remove.

$keyend : string

The ending phrase to remove.

Return values
string

The resulting string with the phrase removed.

getSmartyTemplate()

Find and get the Smarty template or retrieves an instance of the Smarty template engine with appropriate settings and assigns common global variables.

getSmartyTemplate([string $templatedir = 'layout/templates' ][, string $basedir = false ][, string $usesitename = true ]) : object
Parameters
$templatedir : string = 'layout/templates'

denotes templatedir.

$basedir : string = false

denotes basedir.

$usesitename : string = true

is the usesitename.

Return values
object

as overall response of the function.

strtodate()

Converts a date string to the format 'mm/dd/yyyy'.

strtodate([string $str = '' ]) : string
Parameters
$str : string = ''

The date string to convert.

Return values
string

The formatted date string

datetostr()

Converts a date string in the format MM/DD/YYYY to a string in the format YYYYMMDD000000.

datetostr([string $date = '' ]) : string
Parameters
$date : string = ''

The date to convert. If empty, the current date and time will be used.

Return values
string

The date string in the format YYYYMMDD000000.

dayafter()

This function has been used to convert date.

dayafter(string $date, int $dayafter) : string

Returns the date that is a certain number of days after a given date. If no date is specified, defaults to the current date.

Parameters
$date : string

The starting date (format: 'YYYYMMDD').

$dayafter : int

The number of days after the starting date.

Return values
string

The resulting date (format: 'YYYYMMDD000000').

f_random()

Generates a random string with specified length and type.

f_random([int $a_digit = 5 ][, int $a_rantype = 1 ]) : string
Parameters
$a_digit : int = 5

The length of the random string.

$a_rantype : int = 1

The type of random string: 1 for alphanumeric, 2 for alphabetic, 3 for numeric.

Return values
string

The generated random string.

redirect_header()

Redirects to a given URL with an optional message and delay time.

redirect_header(string $url[, int $time = 3 ][, string $message = '' ]) : void
Parameters
$url : string

The URL to redirect to.

$time : int = 3

The delay time in seconds before redirecting (default is 3 seconds).

$message : string = ''

The message to display (default is an empty string).

Return values
void

f_date()

Format date in given format

f_date(string $dt[, string $fmt = 'd-M-y' ]) : string
Parameters
$dt : string

Date string to format

$fmt : string = 'd-M-y'

Format string (default: 'd-M-y')

Return values
string

Formatted date string

trimWhiteSpace()

Trims whitespace characters from the beginning and end of a string.

trimWhiteSpace(string $str) : string
Parameters
$str : string

The input string to remove CDATA tags from

Return values
string

The resulting string with CDATA tags removed

removeCDATA()

Removes CDATA tags from a given string

removeCDATA(string $str) : string
Parameters
$str : string

The input string to remove CDATA tags from

Return values
string

The resulting string with CDATA tags removed

validXMLChr()

Removes invalid characters from XML content.

validXMLChr(string $content) : string
Parameters
$content : string

The XML content to validate.

Return values
string

The validated XML content.

removeHighAscii()

Removes high ASCII characters from the input string and replaces them with spaces.

removeHighAscii(string $content) : string
Parameters
$content : string

The input string to sanitize.

Return values
string

The sanitized string with high ASCII characters replaced with spaces.

remfiles()

Deletes all files in the given directory that match the specified pattern.

remfiles(string $path, string $match) : bool
Parameters
$path : string

The directory to search for files in.

$match : string

The pattern to match file names against.

Return values
bool

Returns true if all files were successfully deleted, false otherwise.

writeFile()

Write data to a file

writeFile(string $file, string $data) : bool
Parameters
$file : string

The file path to write to

$data : string

The data to write to the file

Return values
bool

True on success, false on failure

uc_unique()

This function has been used to return unique number.

uc_unique(int $ctime[, int $base = 36 ][, bool $is_rand = true ][, int $size = 8 ]) : string

Generates a unique ID based on the current time and optionally a random number.

Parameters
$ctime : int

The current time as a Unix timestamp. If not provided or 0, the current time will be used.

$base : int = 36

The numeric base to use for the encoding. Defaults to 36.

$is_rand : bool = true

Whether to include a random number in the unique ID. Defaults to true.

$size : int = 8

The desired size of the unique ID. Defaults to 8.

Return values
string

The generated unique ID.

GUID64_encode()

Encodes an integer using base 64 and returns a string of a specified size.

GUID64_encode(int $i[, int $size = 2 ]) : string
Parameters
$i : int

The integer to encode.

$size : int = 2

The desired size of the resulting string. Default is 2.

Return values
string

The base 64 encoded string.

GUID64_decode()

Decodes a base-64 encoded GUID string into a decimal number.

GUID64_decode(string $s) : int
Parameters
$s : string

The base-64 encoded GUID string to decode.

Return values
int

The decimal number representation of the GUID.

uc_unique_rev()

This function has been used to reverse unique no.. Decode a unique string generated with uc_unique.

uc_unique_rev(string $string[, int $base = 36 ][, bool $is_rand = true ][, int $size = 8 ]) : mixed
Parameters
$string : string

The unique string to decode.

$base : int = 36

The number base to use for decoding the string. Default is 36.

$is_rand : bool = true

Whether the unique string includes random characters. Default is true.

$size : int = 8

The number of characters in the unique string. Default is 8.

Return values
mixed

Returns the decoded timestamp (and random characters, if applicable) as a string or integer.

dec2string()

Converts a decimal number to a string representation in the given base.

dec2string(string $decimal, int $base[, bool $firstalpha = false ]) : string|false
Parameters
$decimal : string

The decimal number to convert.

$base : int

The base to use for the string representation.

$firstalpha : bool = false

Whether to include the first alphabetical characters in the charset.

Return values
string|false

The string representation of the decimal number in the given base, or false if an error occurred.

string2dec()

Convert a string in a given base to a decimal number.

string2dec(string $string, int $base) : string|false
Parameters
$string : string

The input string.

$base : int

The base of the input string.

Return values
string|false

The decimal number as a string on success, false on failure.

getMicroTime()

Returns the current Unix timestamp with microseconds

getMicroTime() : float
Return values
float

The current Unix timestamp with microseconds

getTimeByTimezone()

Returns the current time in the specified time zone.

getTimeByTimezone([string $time_zone = 'Europe/London' ][, string $format = 'Y-m-d H:i:s' ]) : string
Parameters
$time_zone : string = 'Europe/London'

The time zone to use, default is 'Europe/London'.

$format : string = 'Y-m-d H:i:s'

The date/time format to return, default is 'Y-m-d H:i:s'.

Return values
string

The current time in the specified time zone, formatted according to the specified format.

setAssessmentDateTime()

Sets the assessment date and time based on a specified timezone option.

setAssessmentDateTime(string $date, string $time, string $timezone_option) : string
Parameters
$date : string

The date in the format 'Y-m-d'.

$time : string

The time in the format 'H:i' or 'H:i:s'.

$timezone_option : string

The timezone option to use, specified as a time offset or timezone string.

Return values
string

The assessment date and time in the format 'Y-M-d H:i:s'.

getEndDate()

Get the end date based on the start date, end date or number of days.

getEndDate([string $start_date = '' ][, string $end_date = '' ][, bool|int $days = false ]) : string
Parameters
$start_date : string = ''

The start date in string format ('Y-m-d').

$end_date : string = ''

The end date in string format ('Y-m-d').

$days : bool|int = false

The number of days to add to the start date.

Return values
string

The end date in the format 'Y-m-d', or an empty string if no date is found.

isDatePassed()

Check if the given date has already passed based on the given timezone.

isDatePassed(string $new_date[, string $time_zone = 'Europe/London' ]) : bool
Parameters
$new_date : string

The date to be checked in string format ('Y-m-d H:i:s').

$time_zone : string = 'Europe/London'

The timezone identifier in which to check the date.

Return values
bool

True if the given date has already passed, false otherwise or if an exception occurred.

joinPaths()

This is the function that has been used to join paths.

joinPaths() : string
Return values
string

as whole response of function.

addProtocol()

Add a protocol to a URL if it does not already have one.

addProtocol(string $url[, string|false $protocol = false ]) : string
Parameters
$url : string

The URL to add a protocol to.

$protocol : string|false = false

The protocol to add to the URL. If false, the function will attempt to determine the protocol automatically.

Return values
string

The URL with the protocol added.

rprint_r()

Recursive version of print_r that returns the result as an associative array.

rprint_r(mixed $in) : array<string|int, mixed>
Parameters
$in : mixed

The input variable to print.

Return values
array<string|int, mixed>

The result as an associative array.

__ucd()

Outputs the given variable for debugging purposes only if the server name is 'localhost'.

__ucd(mixed $a[, bool $isDie = 1 ][, bool $isPre = 1 ]) : void

It is print_r with

 tags in it running on only local server *

Parameters
$a : mixed

The variable to output.

$isDie : bool = 1

Whether to terminate the script after outputting the variable.

$isPre : bool = 1

Whether to wrap the output in a

 tag for better readability.

Return values
void

str2Assoc()

Convert a string to an associative array

str2Assoc(string $str[, string $sep_1 = ',' ][, string $sep_2 = '|' ]) : array<string|int, mixed>
Parameters
$str : string

The string to convert

$sep_1 : string = ','

The separator used to split the string into key-value pairs

$sep_2 : string = '|'

The separator used to split each key-value pair

Return values
array<string|int, mixed>

The resulting associative array

ucIsset()

Check if a variable is set and not empty, and optionally compare it to a given value.

ucIsset(mixed $v[, mixed $val = false ]) : bool
Parameters
$v : mixed

The variable to check.

$val : mixed = false

The value to compare $v to (optional).

Return values
bool

Returns true if $v is set and not empty (and optionally equal to $val), false otherwise.

ucInStr()

This is the function that has been used to return haystack.

ucInStr(string $needle, string $str[, string $delimiter = ',' ]) : bool

Searches for the occurrence of a string within a comma-separated list of strings.

Parameters
$needle : string

The string to search for.

$str : string

The comma-separated list of strings to search in.

$delimiter : string = ','

The delimiter used to separate the strings.

Return values
bool

True if the string is found in the list, false otherwise.

ucTblStr()

Create a table row from an array of data.

ucTblStr(mixed $arr[, bool $thead = false ][, bool $istr = false ]) : string
Parameters
$arr : mixed

The data to be used to create the table row. Can be an array or a string.

$thead : bool = false

Whether the row is a table header row.

$istr : bool = false

Whether to wrap the row in tags.

Return values
string

The HTML string representing the table row.

ucItemsByArray()

This is the function that has been used to return array by uc items.

ucItemsByArray(array<string|int, mixed> $items, string $item) : array<string|int, mixed>

Returns an array of values from an array of associative arrays *

Parameters
$items : array<string|int, mixed>

Array of associative arrays

$item : string

Key name to retrieve from each associative array

Return values
array<string|int, mixed>

Array of values for the given key name

get_string_between()

Returns a string between two delimiters in a larger string.

get_string_between(string $string, string $start, string $end) : string
Parameters
$string : string

The larger string to search in.

$start : string

The starting delimiter.

$end : string

The ending delimiter.

Return values
string

The substring between the two delimiters.

ucArrayByItem()

Return an associative array indexed by a specific item in a nested array.

ucArrayByItem(array<string|int, mixed> $arr, string $item[, string|false $val_str = false ]) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The array to traverse.

$item : string

The key to use as the index.

$val_str : string|false = false

A comma-separated list of values to include in the output.

Return values
array<string|int, mixed>

An associative array indexed by the specified key.

strToHex()

Convert a string to its hexadecimal representation.

strToHex(string $string) : string
Parameters
$string : string

The input string to convert.

Return values
string

The hexadecimal representation of the input string.

hex2bin()

Converts a hexadecimal string to its binary representation.

hex2bin(string $hex) : string
Parameters
$hex : string

The hexadecimal string to convert.

Return values
string

The binary representation of the input.

generateAuthToken()

Generates an authentication token using AES-256-CBC encryption.

generateAuthToken(string $string, string $secret_key) : string
Parameters
$string : string

The string to encrypt and include in the token.

$secret_key : string

The secret key to use for encryption.

Return values
string

The generated authentication token.

extractAuthToken()

Extracts a string from an encrypted token generated using generateAuthToken function.

extractAuthToken(string $encrypt_string, string $secret_key) : string|null
Parameters
$encrypt_string : string

The encrypted token string to extract from.

$secret_key : string

The secret key used to encrypt the token.

Return values
string|null

The decrypted string or null if the token is invalid.

array_merge_uc()

Merge two arrays, optionally recursively.

array_merge_uc(array<string|int, mixed> $arr1, array<string|int, mixed> $arr2[, bool|int $recursive = false ]) : array<string|int, mixed>
Parameters
$arr1 : array<string|int, mixed>

The first array to merge

$arr2 : array<string|int, mixed>

The second array to merge

$recursive : bool|int = false

Whether to merge the arrays recursively

Return values
array<string|int, mixed>

The merged array

array_keys_uc()

Returns all the keys or specific keys of an array, optionally filtered by value.

array_keys_uc(array<string|int, mixed> $arr[, mixed $value = false ]) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The input array.

$value : mixed = false

The value to filter keys by. If set, only keys with this value will be returned.

Return values
array<string|int, mixed>

The array keys.

array_unique_uc()

Removes duplicate values from an array.

array_unique_uc(array<string|int, mixed> $arr) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The input array.

Return values
array<string|int, mixed>

The array with duplicate values removed.

count_uc()

Counts the number of elements in an array.

count_uc(array<string|int, mixed> $arr) : int
Parameters
$arr : array<string|int, mixed>

The array to count elements in.

Return values
int

The number of elements in the array.

array_change_key_uc()

Returns a new array with the keys changed to the value of the specified key in the original array

array_change_key_uc(array<string|int, mixed> $arr, string $key) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The original array to be modified

$key : string

The key to use as the new array key

Return values
array<string|int, mixed>

The new array with keys changed to the value of $key

multi_array_sort()

Sorts a multidimensional array by a specified key

multi_array_sort(array<string|int, mixed> &$data, string $key[, bool $reverse_sort = false ]) : mixed
Parameters
$data : array<string|int, mixed>

The array to be sorted

$key : string

The key to sort by

$reverse_sort : bool = false

Whether to sort in reverse order

Return values
mixed

Obfuscates a given link by encoding it using base64 and rawurlencode.

obfuscate_link(string $temp) : string
Parameters
$temp : string

The link to be obfuscated.

Return values
string

The obfuscated link.

Converts a number of seconds into a human-readable string

unobfuscate_link(string $link) : string
Parameters
$link : string

denotes link.

Return values
string

as overall response of the functions.

seconds2human()

This is the function that has been used to convert seconds to human.

seconds2human(string $seconds[, string $is_short = true ][, string $return_index = '' ]) : string
Parameters
$seconds : string

denotes seconds.

$is_short : string = true

denotes is_short.

$return_index : string = ''

denotes return_index.

Return values
string

as overall response of the functions.

friendlyDate()

Returns a human-readable string representing the time elapsed since the provided timestamp

friendlyDate(int $time) : string
Parameters
$time : int

Unix timestamp to calculate time elapsed from

Return values
string

Human-readable string representing time elapsed

formatISBN()

Format a given ISBN number into a standard format with hyphens.

formatISBN(string $isbn) : string
Parameters
$isbn : string

The ISBN number to format.

Return values
string

The formatted ISBN number.

addToArchive()

Adds files from a directory to a ZIP archive.

addToArchive(string $filePath, string $output_archive[, string|false $output_zip_name = false ][, bool $download = false ][, bool $remove = true ]) : void
Parameters
$filePath : string

The path of the directory containing the files to be added to the archive.

$output_archive : string

The path of the ZIP archive to create.

$output_zip_name : string|false = false

The name of the ZIP archive to be downloaded, or false to use the default name.

$download : bool = false

Whether to download the ZIP archive.

$remove : bool = true

Whether to remove the original files after adding them to the archive.

Return values
void

dateafter()

Returns the date after a specified number of days after a given date.

dateafter(string $date, int $daysafter) : string
Parameters
$date : string

The date to start from in YYYY-MM-DD format.

$daysafter : int

The number of days after the starting date to return (default 0).

Return values
string

The resulting date in YYYY-MM-DD format.

timezoneDoesDST()

Check if the given timezone observes Daylight Saving Time (DST).

timezoneDoesDST(string $tzId[, int|false $time_zone_offset = false ]) : bool|int
Parameters
$tzId : string

The timezone identifier (e.g. "America/New_York").

$time_zone_offset : int|false = false

The timezone offset from GMT in hours.

Return values
bool|int

Returns true if the timezone observes DST, false if not. If an error occurs, returns false.

get_time_difference()

Calculates the time difference between two time values

get_time_difference(string $start_time, string $end_time[, string $format = '%H:%I:%S' ]) : string
Parameters
$start_time : string

The starting time value

$end_time : string

The ending time value

$format : string = '%H:%I:%S'

The output format for the time difference, defaults to '%H:%I:%S'

Return values
string

The time difference in the specified format.

convertToUTC()

Convert a given time to UTC time

convertToUTC(int $time, array<string|int, mixed> $time_zone_dst[, int $time_zone = false ]) : int
Parameters
$time : int

The time to be converted

$time_zone_dst : array<string|int, mixed>

An array of time zone DST information

$time_zone : int = false

The time zone offset in minutes

Return values
int

The converted UTC time

generateAccessToken()

Generates an access token for a client with the given ID and email.

generateAccessToken(string $client_id, string $email[, string|false $suffix_str = false ][, int $key_type = 1 ]) : array<string|int, mixed>
Parameters
$client_id : string

The client ID.

$email : string

The client email.

$suffix_str : string|false = false

An optional string to add as a suffix to the token.

$key_type : int = 1

The type of key to use for the token (default is 1).

Return values
array<string|int, mixed>

An array containing the access token and status message.

verifyAccessToken()

Verify the access token using JWT decode

verifyAccessToken(string $token) : string
Parameters
$token : string

denotes token.

Return values
string

as overall response of the functions.

refreshAccessToken()

This is the function that has been used to refresh access token.

refreshAccessToken(mixed $old_token) : object|bool
Parameters
$old_token : mixed
Return values
object|bool

Returns the decoded token object on success or false on failure

friendlyguid()

Converts a GUID to a more friendly format by replacing confusing characters.

friendlyguid(string $guid) : string
Parameters
$guid : string

The GUID to convert.

Return values
string

The converted GUID.

getUserIP()

Get the user's IP address.

getUserIP() : string
Return values
string

User's IP address or "UNKNOWN" if unable to detect.

array_column_uc()

This is the function that has been used to get columns of array.

array_column_uc(array<string|int, mixed> $array, string $column) : array<string|int, mixed>

Get an array of values from a specific column in a multi-dimensional array with uppercase column names.

Parameters
$array : array<string|int, mixed>

The input array.

$column : string

The column to retrieve the values from.

Return values
array<string|int, mixed>

The resulting array of values from the specified column.

bin2ip()

This is the function that has been used to get bin from IP.

bin2ip(string $bin) : string

Convert binary representation of IP address to string

Parameters
$bin : string

Binary representation of IP address

Return values
string

Returns string representation of IP address

removeStrSpace()

Removes whitespace characters from a string.

removeStrSpace([string $str = true ]) : string
Parameters
$str : string = true

The input string to process.

Return values
string

The input string with all whitespace characters removed.

json_validate()

Validate a JSON string and return the decoded result.

json_validate(string $string[, string &$error = '' ]) : mixed
Parameters
$string : string

The JSON string to validate.

$error : string = ''

A reference to a variable that will contain the error message if the JSON is invalid.

Return values
mixed

The decoded JSON data if valid, or false if invalid.

resizeImage()

Resize an image and save it to the specified path.

resizeImage(string $imgObject, string $savePath, string $image_type, string $imgName, int $imgMaxWidth, int $imgMaxHeight, int $imgQuality) : void
Parameters
$imgObject : string

The image file path.

$savePath : string

The path where the resized image will be saved.

$image_type : string

The type of the image, e.g. 'jpg', 'jpeg', 'png', etc.

$imgName : string

The name of the resized image file.

$imgMaxWidth : int

The maximum width of the resized image.

$imgMaxHeight : int

The maximum height of the resized image.

$imgQuality : int

The quality of the resized image, from 0 to 100.

Return values
void

uf_findkey()

Find the key from a string

uf_findkey(string $str, string &$key) : string
Parameters
$str : string

The input string to find the key from

$key : string

The variable to store the found key

Return values
string

The value found after the key

utf8json()

Encode an array to UTF-8 encoded JSON string

utf8json(array<string|int, mixed> $inArray) : string
Parameters
$inArray : array<string|int, mixed>

The array to encode

Return values
string

The encoded JSON string

getContentsGUIDs()

Function to get contentGUIDs based on filters

getContentsGUIDs(mixed $coverage, mixed $seq2coverage[, mixed $content_type = 'q,u,f' ][, mixed $content_subtype = false ][, mixed $parent_guid = false ][, mixed $testnos = -1 ][, mixed $level = false ][, mixed $demo = -1 ][, mixed $visible = 1 ]) : mixed
Parameters
$coverage : mixed
$seq2coverage : mixed
$content_type : mixed = 'q,u,f'
$content_subtype : mixed = false
$parent_guid : mixed = false
$testnos : mixed = -1
$level : mixed = false
$demo : mixed = -1
$visible : mixed = 1
Tags
returns

array list of GUIDS

Return values
mixed

getDisabledGuids()

Remove elements from an array based on keys present in another array.

getDisabledGuids(array<string|int, mixed> $config_setting, array<string|int, mixed> $coverage, array<string|int, mixed> $seq2coverage) : array<string|int, mixed>
Parameters
$config_setting : array<string|int, mixed>

denotes config_setting.

$coverage : array<string|int, mixed>

is the coverage.

$seq2coverage : array<string|int, mixed>

is the seq2coverage.

Return values
array<string|int, mixed>

as whole response of function.

removeInvisible()

This function eliminate invisible guids from the question list

removeInvisible(array<string|int, mixed> $ques, array<string|int, mixed> $invisible[, bool $only_array = false ]) : array<string|int, mixed>
Parameters
$ques : array<string|int, mixed>

is the ques.

$invisible : array<string|int, mixed>

is the invisible.

$only_array : bool = false

is the boolean.

Return values
array<string|int, mixed>

as response of the function.

delete_from_coverage()

Deletes a given content GUID from a coverage array.

delete_from_coverage(array<string|int, mixed> $coverage, string $content_guid) : array<string|int, mixed>
Parameters
$coverage : array<string|int, mixed>

The coverage array to modify.

$content_guid : string

The content GUID to remove from the coverage.

Return values
array<string|int, mixed>

The modified coverage array.

setAnswerSeq()

Sets answer sequence for an array of answers.

setAnswerSeq(array<string|int, mixed> $answers, int &$total_answers, int &$correct_answers, int $ansSeqType) : array<string|int, mixed>
Parameters
$answers : array<string|int, mixed>

The array of answers to set sequence for.

$total_answers : int

The total number of answers.

$correct_answers : int

The total number of correct answers.

$ansSeqType : int

The type of answer sequence to use.

Return values
array<string|int, mixed>

The updated array of answers with sequence.

getAnswerSeqStr()

Returns the answer sequence string based on the given parameters.

getAnswerSeqStr(string $seq, string $type[, string $flip = false ]) : array<string|int, mixed>
Parameters
$seq : string

is the seq.

$type : string

is the type.

$flip : string = false

is the flip.

Return values
array<string|int, mixed>

as response of the function.

get_grade_formula_default()

Get the default grade formula in a JSON-encoded string or as an array

get_grade_formula_default([bool $is_array = false ]) : string|array<string|int, mixed>
Parameters
$is_array : bool = false

Flag to determine if the formula should be returned as an array

Return values
string|array<string|int, mixed>

The default grade formula in a JSON-encoded string or as an array, based on the $is_array flag

get_grade_scale_default()

Returns the default grade scale as a JSON string or array.

get_grade_scale_default([bool $is_array = false ]) : string|array<string|int, mixed>
Parameters
$is_array : bool = false

If true, returns the grade scale as an associative array. Default is false.

Return values
string|array<string|int, mixed>

Returns the default grade scale as a JSON string or array, depending on the value of $is_array.

get_course_config_default()

It is the function that has been used to get default config detail.

get_course_config_default() : mixed

Returns the default course configuration*@return string The default course configuration in JSON format

Return values
mixed

get_coverage_default()

Returns the default coverage for a course, in JSON format.

get_coverage_default([string $chapter_guid = '' ]) : string
Parameters
$chapter_guid : string = ''

The GUID of the chapter to include in the coverage.

Return values
string

The default coverage, in JSON format.

getTestName()

Returns the name of a test based on its type and optional details.

getTestName(int $ttype[, string $detail = '' ][, bool $isShort = false ][, array<string|int, mixed> $testName = array() ]) : string
Parameters
$ttype : int

The type of test.

$detail : string = ''

Optional details about the test.

$isShort : bool = false

Whether to return the short version of the test name.

$testName : array<string|int, mixed> = array()

Optional array of custom test names.

Return values
string

The name of the test.

zfill()

Pads the given number with leading zeros until it reaches the given length.

zfill(string $n, int $a) : string
Parameters
$n : string

The number to pad with leading zeros.

$a : int

The desired length of the resulting string.

Return values
string

The padded string.

get_range()

Returns a value within a specific range, or a default value if not set

get_range(mixed $var, mixed $min, mixed $max, mixed $default) : mixed
Parameters
$var : mixed

The value to check

$min : mixed

The minimum value of the range

$max : mixed

The maximum value of the range

$default : mixed

The default value to return if $var is not set

Return values
mixed

The value within the specified range or the default value

get_default()

Returns a default value if the primary value is empty, else returns the primary value.

get_default(mixed $primary_value, mixed $default_value, mixed $second_value) : mixed
Parameters
$primary_value : mixed

The primary value to be checked for empty.

$default_value : mixed

The default value to be returned if primary value is empty.

$second_value : mixed

An optional secondary value to be used if primary value is empty.

Return values
mixed

The primary value if not empty, otherwise returns the default value or the secondary value.

replaceconst()

Replaces constants in a string with their corresponding values.

replaceconst(string $ls_online[, bool $nolinebreak = false ]) : string
Parameters
$ls_online : string

The string to search and replace.

$nolinebreak : bool = false

Optional. If true, removes line breaks from the string.

Return values
string

The string with constants replaced by their corresponding values.

replaceimage()

Replaces images in a string with secure URLs, if necessary.

replaceimage(string $str) : string
Parameters
$str : string

The string to replace images in.

Return values
string

The string with replaced images.

replacelinebreak()

Replace line break tags and syntax tags with proper <pre> tags for syntax highlighting

replacelinebreak(string $str[, string $nolinebreak = false ]) : string
Parameters
$str : string

is the str.

$nolinebreak : string = false

is the nolinebreak.

Return values
string

as response of the function.

byte2array()

Converts a byte to an array of bits, using a given default array as a template.

byte2array(int $byte, array<string|int, mixed> $defarray[, int $len = 1 ]) : array<string|int, mixed>
Parameters
$byte : int

The byte to convert.

$defarray : array<string|int, mixed>

The default array to use as a template.

$len : int = 1

The length of the byte in bytes (default: 1).

Return values
array<string|int, mixed>

The resulting array of bits.

arrayFilterBasedOnKey()

arrayFilterBasedOnKey(mixed $convert_array, mixed $target_array[, mixed $seprator = ', ' ]) : mixed
Parameters
$convert_array : mixed
$target_array : mixed
$seprator : mixed = ', '
Return values
mixed

array2byte()

This function is used to convert array into byte.

array2byte(string $option, array<string|int, mixed> $defarray[, string $len = 1 ]) : string
Parameters
$option : string

is the option.

$defarray : array<string|int, mixed>

is the defarray.

$len : string = 1

is the len.

Return values
string

as response of the function.

get_ddl_data_uc()

This function is used to get ddl data.

get_ddl_data_uc(array<string|int, mixed> $array, string $idcolumn, string $datacolumn[, string $ddl = 1 ]) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

is the array.

$idcolumn : string

is the idcolumn.

$datacolumn : string

is the datacolumn.

$ddl : string = 1

is the ddl.

Return values
array<string|int, mixed>

as response of the function.

getFlashCardContentSubtypes()

Get FlashCard content subtypes.

getFlashCardContentSubtypes([bool $ret_array = false ]) : mixed
Parameters
$ret_array : bool = false

Whether to return an array or a comma-separated string.

Return values
mixed

An array or a comma-separated string of content subtypes.

extractArray()

This function is used to extract array.

extractArray(array<string|int, mixed> $arr[, string $indexes = '' ][, bool $ignore_blank = false ]) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The input array

$indexes : string = ''

A comma-separated list of indexes to extract

$ignore_blank : bool = false

Whether to ignore blank values or not

Return values
array<string|int, mixed>

The resulting array with extracted values

unsetArrayData()

This function is used to unset array data.

unsetArrayData(array<string|int, mixed> $arr, string $indexes) : array<string|int, mixed>
Parameters
$arr : array<string|int, mixed>

The input array

$indexes : string

A comma-separated list of indexes to be unset

Return values
array<string|int, mixed>

The input array with specified indexes unset

findexts()

Returns the file extension of a given filename

findexts(string $filename) : string|void
Parameters
$filename : string

The filename to extract extension from

Return values
string|void

The file extension, or void if the input is empty or invalid

get_file_extension()

Get the file extension and name from a file path.

get_file_extension(string $file_name) : array<string|int, mixed>
Parameters
$file_name : string

The file path.

Return values
array<string|int, mixed>

An array containing the file extension and name.

getSeqList()

A function to Get Sequence List of Guid.

getSeqList(string $guid, array<string|int, mixed> $coverage, array<string|int, mixed> $seq2coverage) : array<string|int, mixed>

Initialises variable $start_slide with $coverage guid[s] and $slide_level with $coverage guid[l] plus 1. Takes a loop for seq2coverage and checks if seq is greater than $start_slide and $coverage guid[l] is equal to $slide_level then checks $coverage guid[t] equal to s then assigns guid value to pslide. Else checks if $coverage guid[t] value is equal to f and $content guid[content_subtype] is greater than or equal to 9 or equal to 45 assigns guid value to pslide and lastly checks for value equal to u and and then return $pslide.

Get sequence list based on coverage and seq2coverage array

Parameters
$guid : string

The guid of the starting slide

$coverage : array<string|int, mixed>

An array containing information about the coverage of each slide

$seq2coverage : array<string|int, mixed>

An array mapping sequences to slide guids

Return values
array<string|int, mixed>

An array of slide guids

getOrderType()

This function is used to get order type.

getOrderType() : array<string|int, mixed>
Return values
array<string|int, mixed>

as overall response of the function.

calcPrice()

Calculate the net price and discount information based on the given data.

calcPrice(array<string|int, mixed> $data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>

is the input array.

Return values
array<string|int, mixed>

as overall response of the function.

extractLicence()

Extracts license information from an array of licenses.

extractLicence(array<string|int, mixed>|string $licences[, bool $is_byte = true ][, bool $full = false ]) : array<string|int, mixed>|string
Parameters
$licences : array<string|int, mixed>|string

The array of licenses or license string to extract from.

$is_byte : bool = true

Whether the license is in byte format or not.

$full : bool = false

Whether to return the full license information.

Return values
array<string|int, mixed>|string

The extracted license information.

findtextnew_withouttrim()

Searches for a string between two other strings in a given string

findtextnew_withouttrim(string $str, string $fstr, string $lstr, int &$i) : string|false
Parameters
$str : string

The string to search in

$fstr : string

The starting string

$lstr : string

The ending string

$i : int

The index of the starting position of the found string

Return values
string|false

The string between the starting and ending strings, or false if not found

findContentImage()

This function is used to find content image.

findContentImage(string $str[, string $maxloop = 15 ][, string $all = true ][, string $xml = false ][, string $is_find_alt = false ]) : array<string|int, mixed>
Parameters
$str : string

is the str.

$maxloop : string = 15

is the maxloop.

$all : string = true

is the all.

$xml : string = false

is the xml.

$is_find_alt : string = false

is the is_find_alt.

Return values
array<string|int, mixed>

as overall response of the function.

findAssets()

It is the function that has been used to detect assets.

findAssets(array<string|int, mixed> $str[, array<string|int, mixed> $maxloop = 15 ]) : array<string|int, mixed>
Parameters
$str : array<string|int, mixed>

denotes str.

$maxloop : array<string|int, mixed> = 15

is the maxloop.

Return values
array<string|int, mixed>

as whole response of function.

findSpanGuids()

Extracts GUIDs from <span> tags in the given string.

findSpanGuids(string $str) : array<string|int, mixed>
Parameters
$str : string

The string to search for tags.

Return values
array<string|int, mixed>

An array of GUIDs found in the tags.

findDevices()

Find all device images in a string.

findDevices(string $str) : array<string|int, mixed>
Parameters
$str : string

The input string to search.

Return values
array<string|int, mixed>

An array of device images found in the input string.

api_convert_test_session_options2array()

Convert test session options from integer to an associative array.

api_convert_test_session_options2array(int $opt) : array<string|int, mixed>
Parameters
$opt : int

The integer value of the options.

Return values
array<string|int, mixed>

An associative array of the test session options.

api_convert_test_session_array2options()

Convert test session options array to binary format.

api_convert_test_session_array2options(array<string|int, mixed> $ary) : int
Parameters
$ary : array<string|int, mixed>

An associative array of options to be converted.

Return values
int

The converted binary format of the options.

api_convert_assignment_schedule_options2array()

Convert an assignment schedule options integer to an associative array.

api_convert_assignment_schedule_options2array(int $opt) : array<string|int, mixed>
Parameters
$opt : int

The assignment schedule options integer.

Return values
array<string|int, mixed>

The assignment schedule options as an associative array.

api_convert_assignment_schedule_array2options()

It is the function that has been used to convert test session array into options.

api_convert_assignment_schedule_array2options(array<string|int, mixed> $ary) : array<string|int, mixed>
Parameters
$ary : array<string|int, mixed>

denotes ary.

Return values
array<string|int, mixed>

as whole response of function.

score2grade()

A function for score to grade.

score2grade(string $grade_scale, string $score[, string $grade_type = '' ]) : string
Parameters
$grade_scale : string

It contains a string of grade.

$score : string

It contains a string for.

$grade_type : string = ''

It contains a string for type of grade.

Return values
string

is the response of the function.

result2grade()

Converts a set of results to grades based on a given grade scale.

result2grade(array<string|int, mixed> $grade_scale, array<string|int, mixed> $results) : array<string|int, mixed>
Parameters
$grade_scale : array<string|int, mixed>

The grade scale to use for converting scores to grades.

$results : array<string|int, mixed>

The set of results to be graded.

Return values
array<string|int, mixed>

An array of grades, one for each result in the set.

getCurrentOSFromServer()

Returns the current operating system from the server.

getCurrentOSFromServer() : string
Return values
string

The name of the operating system.

json_encode_uc()

Encode the given data as JSON with support for encoding Unicode characters

json_encode_uc(mixed $data, int $options[, int $depth = 512 ]) : string|false
Parameters
$data : mixed

The data to be encoded

$options : int

[optional] Bitmask of JSON encoding options

$depth : int = 512

[optional] Maximum depth to traverse when encoding

Return values
string|false

A JSON encoded string on success, false on failure

json_decode_uc()

Decodes a JSON string and returns the resulting value.

json_decode_uc(string $string[, bool $assoc = false ][, int $depth = 512 ], int $options) : mixed
Parameters
$string : string

The JSON string to decode.

$assoc : bool = false

Optional. When true, returned objects will be converted into associative arrays.

$depth : int = 512

Optional. User specified recursion depth.

$options : int

Optional. Bitmask of JSON decode options.

Return values
mixed

The value encoded in JSON or false on failure.

rand_uc()

Generate a random number within a given range.

rand_uc([int|false $min = false ][, int|false $max = false ]) : int
Parameters
$min : int|false = false

The minimum value of the range (default: 0).

$max : int|false = false

The maximum value of the range (default: getrandmax()).

Return values
int

The random number generated within the given range.

strip_all_tags_uc()

A function for to strip tags.

strip_all_tags_uc(string $string) : string
Parameters
$string : string

is the string.

Return values
string

as response of the function.

file_get_contents_uc()

Read entire contents of a file into a string

file_get_contents_uc(string $file_name[, bool $include_path = false ][, resource|null $context = null ], int $start) : string|false
Parameters
$file_name : string

Name of the file to read

$include_path : bool = false

Optional. Search for the file in the include_path. Default is false.

$context : resource|null = null

Optional. A valid context resource created with stream_context_create(). Default is null.

$start : int

Optional. The position in bytes to start reading. Default is 0.

Return values
string|false

Returns the read data or false on failure.

debug_backtrace_uc()

A function for to get debug trace.

debug_backtrace_uc([string $options = DEBUG_BACKTRACE_PROVIDE_OBJECT ], string $limit) : array<string|int, mixed>
Parameters
$options : string = DEBUG_BACKTRACE_PROVIDE_OBJECT

is the options.

$limit : string

is the limit.

Return values
array<string|int, mixed>

as response of the function.

sanitize_title_with_dashes_uc()

Sanitizes a title, replacing whitespace and a few other characters with dashes. * Limits the output to alphanumeric characters, underscore (_) and dash (-).

sanitize_title_with_dashes_uc(string $title) : string

Whitespace becomes a dash.

Parameters
$title : string

The title to be sanitized.

Tags
since
1.2.0
Return values
string

The sanitized title.

file_get_contents_curl()

Retrieve the contents of a URL using cURL.

file_get_contents_curl(string $url) : string
Parameters
$url : string

The URL to retrieve.

Return values
string

The contents of the URL, or false if the request fails.

create_redis_key()

Generates a Redis key using a given string value and prefix.

create_redis_key(string $val[, string $prefix = 'p:' ]) : string
Parameters
$val : string

is the val.

$prefix : string = 'p:'

is the prefix.

Return values
string

as response of the function.

get_sys_mac_address()

Retrieve the MAC address of the current system.

get_sys_mac_address() : string|null
Return values
string|null

The MAC address if it can be found, otherwise null.

array_merge_preserve()

Merge arrays while preserving keys.

array_merge_preserve(array<string|int, mixed> ...$arrays) : array<string|int, mixed>
Parameters
$arrays : array<string|int, mixed>

Variable-length array of arrays to be merged.

Return values
array<string|int, mixed>

Merged array.

__ucc()

This is the function that has been used to debug and print data in jigyaasa.

__ucc(array<string|int, mixed> $a[, array<string|int, mixed> $isDie = 1 ][, array<string|int, mixed> $isPre = 1 ]) : mixed
Parameters
$a : array<string|int, mixed>

denotes a.

$isDie : array<string|int, mixed> = 1

denotes isDie.

$isPre : array<string|int, mixed> = 1

denotes isPre.

Return values
mixed

generateNewPassword()

Generates a new random password.

generateNewPassword() : string
Return values
string

A new password string.

getLMSPlatformIDFromURL()

Returns the LMS platform ID based on the given URL.

getLMSPlatformIDFromURL(string $url) : string
Parameters
$url : string

The URL to check.

Return values
string

The LMS platform ID or 'unknown' if not found.

Search results