Skip to content

Check Functions App: test if functions, methods, class existed in PHP

September 10, 2013

The application uses the functions function_exists, method_exists,  is_callable, get_defined_functions, class_exists, extension_loaded. you can understand what the function does just by its name. also in the app are links for phpinfo and  more to help developers handle php easier.

All that needs to be done is extract the folder to your server. I use WAMP so i put it in the www folder.

HTML CODE

  1. <?php require_once(“includes/functions.php”); ?>
  2. <html>
  3. <head>
  4. <title>
  5. You Test Your WebPage Here
  6. </title>
  7. <link href = “stylesheets/style.css” media = “all” rel = “stylesheet” type = “text/css” />
  8. <!– set the greybox plugin. the name of the folder must not be changed–>
  9. <script type=”text/javascript”>
  10. var GB_ROOT_DIR = "http://localhost/Check%20Funcions%20App/greybox/";
  11. </script>
  12. <!– set links for the scripts of greybox, credits to the dev.–>
  13. <script type=”text/javascript” src=”greybox/AJS.js”></script>
  14. <script type=”text/javascript” src=”greybox/AJS_fx.js”></script>
  15. <script type=”text/javascript” src=”greybox/gb_scripts.js”></script>
  16. <!– style of greybox–>
  17. <link href=”greybox/gb_styles.css” rel=”stylesheet” type=”text/css” />
  18. </head>
  19. <body>
  20. <!– ignore the table elements, what matter here is the php code–>
  21. <table id = “OUTERBOX-BLACK”>
  22. <tr>
  23. <td id = “INNERBOX-IMAGE”>
  24. <div id = “firstBox”>
  25. <ul class = “lettersFirst”>
  26. Useful PHP Functions for Web Developers
  27. </ul>
  28. by: Ryndon
  29. </div>
  30. <table id = “table-rows”>
  31. <td id = “td-secondBox”>
  32. <div id = “secondBox”>
  33. <ul class = “lettersSecond”>
  34. <?php
  35. // fires the function in the includes folder.
  36. // displays links like php info etc
  37. displayInfo ();
  38. // checks if a button is clicked
  39. // a form will be displayed
  40. if (isset ($_GET[‘function’])){
  41. displayMessage($_GET[‘function’]);
  42. // sets the functions name for the $_GET value
  43. echo “<form action = ‘index.php?function=”;
  44. echo $_GET[‘function’];
  45. echo “‘ method = ‘post’>”;
  46. echo “<font size = 5 face = candara>”.$_GET[‘function’].” (“;
  47. echo “<input type=’text’ name=’keyFunc’ maxlength=’30′”;
  48. if (isset ($_POST[‘keyFunc’]))
  49. echo “value=” . $_POST[‘keyFunc’];
  50. echo “>”.”) “.”</font>”;
  51. echo “</br></br><input src=’images/submit.png’ type=’image’
  52. name=’submit’ value=’submit’/>”;
  53. echo “</form>”;
  54. if (@$_POST[‘keyFunc’] != NULL) {
  55. // checks if there is a value typed
  56. if (@$_GET[‘function’] ($_POST[‘keyFunc’])) {
  57. // output message
  58. echo “AVAILABLE.<br />\n”;
  59. }else{
  60. echo “NOT AVAILABLE.<br />\n”;
  61. }
  62. }else{
  63. echo “WRITE A FUNCTION <br>IN THE TEXT BOX”;
  64. }
  65. }
  66. ?>
  67. </ul>
  68. </div>
  69. </td>
  70. <td id = “td-thirdBox”>
  71. <div id = “thirdBox”>
  72. <ul class = “lettersThird”>
  73. <?php
  74. // displays the buttons for the functions
  75. redirect_samePage (“function_exists”);
  76. redirect_samePage (“method_exists”);
  77. redirect_samePage (“is_callable”);
  78. redirect_samePage (“get_defined_functions”);
  79. redirect_samePage (“class_exists”);
  80. redirect_samePage (“extension_loaded”);
  81. ?>
  82. </ul>
  83. </div>
  84. </td>
  85. </table>
  86. </td>
  87. </tr>
  88. </table>
  89. </body>
  90. </html>

the functions used above are found in the includes folder, the functions.php. below are the codes in it

HTML CODE

  1. <?php
  2. // gets links with $_GET values
  3. function redirect_samePage( $getValue = NULL ) {
  4. if ($getValue != NULL) {
  5. echo “<a href=’index.php?function=$getValue’>”;
  6. // a space is provided to adjust
  7. echo “<img src=’images/$getValue.png’> “;
  8. echo “</br></a>”;
  9. }
  10. }
  11. // display info on functions
  12. function displayMessage ($func = NULL) {
  13. echo “<font size = 3 color = ‘white’ face = ‘candara’>”;
  14. if ($func == “function_exists”) {
  15. echo “Checks the list of defined functions, both built-in (internal) and user-defined”;
  16. }else if ($func == “method_exists”){
  17. echo “Checks if the class method exists”;
  18. }else if ($func == “is_callable”){
  19. echo “Verify that the contents of a variable can be called as a function”;
  20. }else if ($func == “get_defined_functions”){
  21. echo “Returns an array of all defined functions”;
  22. }else if ($func == “class_exists”){
  23. echo “Checks if the class has been defined”;
  24. }else if ($func == “extension_loaded”){
  25. echo “Find out whether an extension is loaded”;
  26. }
  27. echo “</font>”;
  28. }
  29. //links for phpInfo and others
  30. function displayInfo (){
  31. ?>
  32. <p align=”left”>
  33. <font size =”4″ face=”times new roman” >
  34. <a href = “INFO_ENVIRONMENT.php” title=”INFO_ENVIRONMENT” rel=”gb_page_fs[]”>INFO_ENVIRONMENT</a><br>
  35. <a href = “INFO_GENERAL.php” title=”INFO_GENERAL” rel=”gb_page_fs[]”>INFO_GENERAL</a><br>
  36. <a href = “INFO_VARIABLES.php” title=”INFO_VARIABLES” rel=”gb_page_fs[]”>INFO_VARIABLES</a><br>
  37. <a href = “phpinfo.php” title=”PHPINFO” rel=”gb_page_fs[]”>PHPINFO</a><br><br><br>
  38. </font>
  39. </p>
  40. <?php
  41. }
  42. ?>

Here are some snapshots of the App.

Simple, Free Image and File Hosting at MediaFire

Simple, Free Image and File Hosting at MediaFire

Simple, Free Image and File Hosting at MediaFire

DOWNLOAD COMPLETE CODES HERE

Advertisements

From → HTML, PHP

4 Comments
  1. Pretty nice post. I just stumbled upon your blog and wished to say that I have truly enjoyed surfing around your blog
    posts. After all I will be subscribing to your rss feed and I
    hope you write again very soon!

    • ryndon2013 permalink

      Your very much welcome! (your comment painted a smile on my face.)

  2. Hello friends, how is everything, and what you wish for to say on the topic of this piece of writing,
    in my view its in fact awesome in favor of me.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

TurtleAndRobot.com

Children's Book Reviews

Malav Shah

official Web Site

My Road to Programming

The journey of how I taught myself to program.

paritoshmishra

Look at what's brewing up guys! we all are work in progress. So don't meander, lets micromesh everything and have candid conversation about every problem related to C, C++ and JAVA. We can rejuvenate the crinkled faces.

ProgramThat;

A simple guide to programming...

ITechonology

Information Techonology

Rahul's Work

My Work Tips and Tutorial on Various Tech.

Turnip Farmers

Kingdom Scans

Gigaom

Technology news, trends and analysis covering mobile, big data, cloud, science, energy and media

The Neighborhood

society online's social conscious

HarsH ReaLiTy

A Good Blog is Hard to Find

VentureBeat

News About Tech, Money and Innovation

retireediary

The Diary of a Retiree

50 Year Project

My challenge to visit 192 countries, read 1,001 books, and watch the top 100 movies

[BTW] : Ben Trube, Writer

Writer, Programmer, Singer

My Arch Walkthrough

Arch linux made easy

Don Charisma

because anything is possible with Charisma

SutoCom Solutions

Success & Satisfaction with the Cloud

%d bloggers like this: