PHP is extremely rich with its implicit capacity and the greater part of us mindful of them. There are many functions which are not known but rather are truly extremely valuable. In this article, I have recorded and clarified couple of minimal known yet truly valuable PHP functions.
php_check_syntax
This is an extremely valuable capacity for checking syntax of a predetermined record.
Use:
<?php
$error_message = “”;
$filename = “./php_script.php”;
if(!php_check_syntax($filename, &$error_message)) {
resound “Blunders were found in the record $filename: $error_message”;
} else {
resound “The record $filename contained no sentence structure blunders”;
}
?>
highlight_string
The highlight_string() capacity can be exceptionally useful while showing PHP code on a site. The capacity restores a language structure featured adaptation of the given PHP code utilizing the hues characterized in the implicit linguistic structure highlighter for PHP. There are two parameters in work, first parameter will be string that can be featured and second parameter will be set to TRUE to influence this capacity to restore the featured code.
Utilization:
<?php
highlight_string(‘ <?php phpinfo(); ?>’);
?>
show_source
The show_source() work is likewise exceptionally convenient which works like highlight_file (). The capacity shows a document with the PHP sentence structure featured. The punctuation is featured by utilizing HTML labels. This capacity returns TRUE on progress, or FALSE on disappointment.
Utilization:
<?php
show_source(“php_script.php”);
?>
php_strip_whitespace
As clarified before, this is like show_source() work. This capacity additionally restores the source code of the particular document by evacuating PHP remarks and whitespace.
Utilization:
<?php
reverberate php_strip_whitespace(“php_script.php”);
?>
__halt_compiler
This capacity ends the execution of the compiler. This can be helpful to implant information in PHP contents, similar to the establishment documents.
Utilization:
<?php
$fp = fopen(__FILE__, ‘r’);
fseek($fp, __COMPILER_HALT_OFFSET__);
var_dump(stream_get_contents($fp));
/the finish of the content execution
__halt_compiler();
?>
highlight_file
This is an exceptionally PHP work which return particular PHP record with the PHP language structure featured.
Use:
<?php
highlight_file(“php_script.php”);
?>
ignore_user_abort
This capacity can be utilized to customer abot content. The customer prematurely ends will make the content quit running.
Utilization:
<?php
ignore_user_abort();
?>
str_word_count
This capacity is utilized to tally the quantity of words found in the string.
Utilization:
<?php
reverberate str_word_count(“Hello How Are You!”);
?>
get_defined_vars
This is a helpful capacity while troubleshooting. This capacity restores a multidimensional exhibit containing a rundown of every characterized variable.
Use:
<?php
print_r(get_defined_vars());
?>
get_Source
This capacity turn upward the browscap.ini document and restore the abilities of the program.
Utilization:
<?php
reverberate $_SERVER[‘HTTP_USER_AGENT’];
$browser = get_source();
print_r($source);
?>
Author Bio:-
Jade Gardner is a Marketing Manager a Hire Php Developer. She is a resident of United Kingdom. Jade is also an experienced Php developer. She also likes to share her thoughts , cms development, PHP software development, and web development techniques.