3 Useful PHP Custom Functions That Every Developer Should Know | General Hacking | Crax

Welcome To Crax.Pro Forum!

Check our new Marketplace at Crax.Shop

   Login! SignUp Now!
  • We are in solidarity with our brothers and sisters in Palestine. Free Palestine. To learn more visit this Page

  • Crax.Pro domain has been taken down!

    Alternatives: Craxpro.io | Craxpro.com

3 Useful PHP Custom Functions That Every Developer Should Know

3 Useful PHP Custom Functions That Every Developer Should Know

LV
1
 

james125

Member
Joined
Nov 30, 2022
Threads
14
Likes
42
Awards
4
Credits
15,027Ā©
Cash
1$
The following three custom functions can be used in PHP applications to help make development easier and faster.


PHP:
<?php
// Returns TRUE if the given string is a valid URL
function isValidUrl($url) {
  return filter_var($url, FILTER_VALIDATE_URL);
}

// Encrypts a string using a given key
function encryptString($string, $key) {
  return base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key, $string, MCRYPT_MODE_ECB));
}

// Decrypts a string using a given key
function decryptString($string, $key) {
  return mcrypt_decrypt(MCRYPT_RIJNDAEL_256, $key, base64_decode($string), MCRYPT_MODE_ECB);
}
?>

That's it! Now you can use these functions to quickly validate URLs, encrypt strings, and decrypt strings. šŸ”
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

Top Bottom