Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

28 August 2018

What are PHP tags?

  • PHP code starts with start tag <?php and end with end tag ?>
  • PHP code can also start with short open tag <?  .To use this short tag you have to enable short_open_tag in php configuration file “php.ini
  • Before PHP version 7, PHP  also supported ASP tags <%, %>, ASP short open tag for <%=, and the script tag <script language="php"> which  has been removed from PHP version 7.
  • If  a PHP file have only PHP codes inside the file  then it is preferable to omit the PHP closing tag ?> at the end of the a PHP file.
  • Example of PHP Tag
  • 1
    2
    3
    4
    5
    <?php // Start PHP Tag
     echo "PHP is easy to learn !!";
     echo "PHP code is executed on web server !!";
    
     // End PHP Tag ?> 
    

  • Output of above PHP code:
    PHP is easy to learn !!PHP code is executed on web server !!

# Good book on PHP:



PHP for the Web: Visual QuickStart Guide (5th Edition)

26 August 2018

What are the Functionalities of PHP?

PHP is a powerful programming language which can be used to develop almost any kind of websites. Some most popular php functionalities are given bellow:

  • PHP is widely used to make dynamic web pages within very short time.
  • Send & Receive Email with PHP is very easy.
  • PHP can quickly Generate, Read, Write, Delete, Open and Close any files on the web servers.
  • PHP is perfect language to work with data Select, Insert, Delete, Update records in database.
  • PHP can be used to collect data from registration form, Login from etc forms.
  • PHP can Send and Receive cookies data stored on client machine.
  • PHP can store session data on servers.
  • PHP can be used to Control user-access on websites.
  • PHP can Encrypt data securely.
  • PHP can Compress files.
  • PHP can be used to Resize & photo enhancement. 
  • PHP can easily create PDF files ,XML Files, Flash files etc for websites.

Why should you learn PHP?



  1. PHP is easy to learn.
  2. PHP Web developer has huge demand in Job Market.
  3. PHP runs on various platforms like Windows, Linux, Unix, Mac OS etc.
  4. PHP supports a wide range of databases like Oracle, MySql, PostgreSQL, MongoDB etc
  5. PHP is free.You can download PHP from the official PHP websites: www.php.net
  6. PHP is a widely-used open source scripting language
  7. PHP is used to make Facebook, Wordpress, Yahoo etc websites.
  8. PHP is the best language which should be know by all web developers.
Head First PHP & MySQL: A Brain-Friendly Guide

19 June 2017

PHP7 Unable to load php_curl.dll extension on windows


Problem:  

PHP Startup: Unable to load dynamic library 'C:\\php7\\ext\\php_curl.dll' - The operating system cannot run %1.\r\n in Unknown on line 0

Solution:

  • Step1: Uncomment the php_curl.dll from php.ini
  • Step2: Copy the following three files from php installed directory.i.e "C:\\php7".
    1. libeay32.dll,
    2. libssh2.dll,
    3. ssleay32.dll
  • Step3: Paste the files under two place
    1. httpd.conf's ServerRoot directive. i.e "C\Apache24"
    2. apache bin directory. i.e "C\Apache24\bin"
  • Step4: Restart apache.
That's all. I solve the problem by this way.Hope it might work for you.


Mastering PHP 7: Design, configure, build, and test professional web applications

30 September 2013

How to Comment your code in PHP?

  • PHP supports 'C', 'C++' and Unix shell-style (Perl style) comments. 
  • You may use any style based on your requirements. 
  • Single-Line code comments use C++ Syntax 
  • Multiple-Line code comments use C Syntax 
  • Unix Shell Syntax (Perl Style) is also used for single line comments 
  • Example: Single-Line C++ Syntax
1
2
3
4
5
6
7
 <?php

        // Title: My first PHP code

          echo "This is a PHP program.";

    ?>
  • Example: Unix Shell Syntax
1
2
3
4
5
6
7
 <?php

       # Title: My first PHP code

          echo "This is a PHP program.";

    ?>
  • Example: Multiple-Line C Syntax
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php

    /*

    Title: Test Code

    Author: shafiq

    Author URL: http://shafiq2410.wordpress.com

    Email: shafiq2410@gmail.com

    */

    echo "This is a PHP program.";

    ?>
PHP Cookbook: Solutions & Examples for PHP Programmers

29 September 2013

How does code is separated in PHP?

  • PHP requires instructions to be terminated with a semicolon at the end of each statement. 
  • The closing tag (?>) of a block of PHP code automatically implies a semicolon(;) 
  • (Ref-Example 2), so you do not need to have a semicolon terminating the last line of a PHP block.
  • Example 1:
1
2
3
4
5
6
7
<?php

        echo 'This is a test';

        echo 'This is another test';

    ?>
  • Example 2:
1
<?php echo 'This is a test' ?>
  • Example 3:
1
<?php echo 'We omitted the last closing tag'; 
  • Note: The closing tag of a PHP block at the end of a file is optional and in some cases omitting it is helpful when using include() or require(), 
  • So unwanted white space will not occur at the end of files, and you will still be able to add headers to the response later.
Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning PHP, MYSQL, Javascript, CSS & HTML5)

What are the Syntax of PHP programming language

  • When PHP parses a file, it looks for opening PHP tag "<?php or <?" and ending php tag " ?>" which tell PHP to start and stop interpreting the code between them. 
  • Everything outside of a pair of opening and closing tags is ignored by the PHP parser. Example:
1
2
3
4
5
 <p>This is going to be ignored by PHP Parser.</p>

        <?php echo 'While this is going to be parsed.'; ?>

    <p>This will also be ignored by PHP parser.</p>
  • PHP code must have a semicolon ";" at the end of each statement.
  • The closing PHP tag "?>" automatically insert a semicolon.
  • Example:
  • 1
    2
    3
    4
    5
    6
    7
    <?php
        echo 'PHP is Fun to learn !!';
    ?>
    <br>
    <?php  echo 'PHP automatically insert a semicolon at the last closing tag' ?>
    <br>
    <?php echo 'If a PHP file have only PHP code than the last closing tag can be omitted';
    
  • Example Advanced escaping
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
<?php

        if ($expression) {

        ?>

        <strong>This is true.</strong>

        <?php

        } else {

        ?>

        <strong>This is false.</strong>

        <?php

        }

        ?> 
  • Before PHP version 7 There were four different pairs of opening and closing tags which could be used in PHP. Standard tag is always available Example: Script tag is also always available Example:
1
2
3
<script language="php">echo 'some editors (like FrontPage) don\'t like processing instructions';

            </script>
  • Short tags can be turned on and off from the php.ini configuration file. Example:
1
<?= expression ?>
  • This is a shortcut for
1
<? echo expression ?>
  • ASP style tags can be turned on and off from the php.ini configuration file Example:
1
<% echo 'You may optionally use ASP-style tags'; %><%= $variable; # This is a shortcut for "<% echo . . ." %>

PHP for the Web: Visual QuickStart Guide (5th Edition)

10 September 2013

Solution of Joomla 3.5 authentication error: Warning JAuthentication: :__construct: Could not load authentication libraries.


joomla login
joomla login


  • The solution steps are given bellow:
  •   Step1: connect your Joomla database with any database tools like phpMyadmin or Navicat for MySQL, I personally like to use Navicat.
 
  • Step2:  Find the tabprefix _extensions table in my case it’s” ybgvu_extensions” & brows for data on that table.
 
  • Step3: Find for the name ”plg_authentication_joomla” & change the enable column value from 0 to 1 & save the change.


JOOMLA tabprefix _extensions
tabprefix _extensions


  • Step 4: It’s done. Now you can login to your Joomla website using your existing username & password.
Joomla Administration panel
Joomla Administration panel

Joomla! Bible

Featured Post

How to Write PHP code and HTML code within a same file

A PHP file can have both PHP code and HTML code together. Any HTML code written outside of PHP <?php //php code here… ?> Code is ig...

Popular Posts