PHP Is a object oriented programming language. In the world nowadays, most of the about 90 % of the web development is done in php language. It is also called as scripting language.
The language php supports all platform ie it is platform independent. It can be used using classes and objects or without classes and objects. It supports numerous types of databases.
like mysql,phpmyadmin and many more.
The important functions and basic of php are as follows:
1) Database Connection in php done in the following way.
2) ucfirst
This is inbuilt function in php. It converts the first letter of the string to capital.
Its Usage is as follows:
<?php
$name="test";
echo ucfirst($name);
?>
output: Test.
3) print_r
This is also inbuilt function in php. It is used for printing an array.
Its usage is as Follows:
<?php
$name_array = array(
'name'=>'test',
'age'=>'23',
'city'=>'abc',
'country'=>'xyz'
);
print_r($name_array);
?>
OutPut Will be as Follows:
Array ( [name] => test [age] => 23 [city] => abc [country] => xyz )
4) base64_encode
This is used to encode a string. It can also encode the numbers or floating numbers.
Usage is as Follows:
<?php
$name="Test";
echo base64_encode($name);
?>
output: VGVzdA==
5) base64_decode
It is useful to decode a encoded string or number.
Its Usage is as follows:
<?php
$name="VGVzdA== ";
echo base64_decode($name);
?>
OutPut: Test
The language php supports all platform ie it is platform independent. It can be used using classes and objects or without classes and objects. It supports numerous types of databases.
like mysql,phpmyadmin and many more.
The important functions and basic of php are as follows:
1) Database Connection in php done in the following way.
2) ucfirst
This is inbuilt function in php. It converts the first letter of the string to capital.
Its Usage is as follows:
<?php
$name="test";
echo ucfirst($name);
?>
output: Test.
3) print_r
This is also inbuilt function in php. It is used for printing an array.
Its usage is as Follows:
<?php
$name_array = array(
'name'=>'test',
'age'=>'23',
'city'=>'abc',
'country'=>'xyz'
);
print_r($name_array);
?>
OutPut Will be as Follows:
Array ( [name] => test [age] => 23 [city] => abc [country] => xyz )
4) base64_encode
This is used to encode a string. It can also encode the numbers or floating numbers.
Usage is as Follows:
<?php
$name="Test";
echo base64_encode($name);
?>
output: VGVzdA==
5) base64_decode
It is useful to decode a encoded string or number.
Its Usage is as follows:
<?php
$name="VGVzdA== ";
echo base64_decode($name);
?>
OutPut: Test
No comments:
Post a Comment