31 August 2018

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 ignored by the PHP parser which allows PHP files to have PHP code and HTML code in a same file.
  • A PHP file must have “.php” extension. 
  • Sample “index.php” file code is given bellow:

  •  1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    <!DOCTYPE html>
    <html>
    <head>
    <title>Web Page Title</title>
    </head>
    <body>
    <?php
     echo "<h1>HTML Code inside PHP code </h1>";
    ?>
    <h1>This is a Heading</h1>
    <?php
     echo "Today's Date is ".date("d-m-y");
    ?>
    <p>This is a paragraph.</p>
    
    </body>
    </html> 
    
  • Output of above code:
  • HTML Code inside PHP code

    This is a Heading

    Today's Date is 01-09-18
    This is a paragraph.
    
    

# Book on PHP:


Learning PHP, MySQL & JavaScript: With jQuery, CSS & HTML5 (Learning PHP, MYSQL, Javascript, CSS & HTML5)

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

What is PHP?


  • PHP stands for "PHP Hypertext Preprocessor" 
  • PHP is a widely-used general-purpose scripting open source scripting language.
  • PHP is especially used for web development and PHP can be embedded into HTML.
  • PHP scripts are executed on the web server.
  • A PHP script starts with start tag "<?php" and ends with end tag "?>" 
  • PHP files have extension ".php". Example of some php files can be index.php, about.php, home.php, contact.php
  • PHP is a powerful programming language which has been used to create Facebook, Wordpress, Yahoo etc websites.
  • Sample PHP Code:
  •  1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    <html>
        <head>
            <title>Example</title>
        </head>
        <body>
    
            <?php
                echo "Hello World!";
            ?>
    
        </body>
    </html> 
    

  • Output of the above PHP Code:
    Hello World!

Beginning PHP and MySQL: From Novice to Professional

07 November 2017

What is SEO (Search Engine Optimization)


  • SEO stands for "Search engine optimization".  
  • All major search engines such as Google, Bing and Yahoo have paid and unpaid search results.  
  • SEO  is the process of getting more visitor to a website from  search engine's  Unpaid, natural, organic results. 
  • SEO professionals do On Page SEO and Off Page SEO to get more visitors to a website from Search Engine results.

The Art of SEO: Mastering Search Engine Optimization

07 September 2017

Difference between HTML and HTML5



  • Hypertext Markup Language (HTML) is the standard markup language for creating web pages and web applications.
  • HTML5 is the W3C Recommendation which adds more powerful features such as header,footer,canvas,audio and video tag support. 
  • Every website is created with HTML and not all modern website is developed with html5 standard.
  • If you know HTML very well then  you can create any Web sites.
  • HTML is very easy to learn.
  • As html5 is the latest version of html,so definitely html5 is better than html. 
  • By following this HTML tutorial series, you will be an expert on HTML.
    Example of popular websites are news website, search engine , video, email, social, sports, social network, games etc    
  • Example HTML5 Code
  •  1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    <!DOCTYPE html>
    <html>
      <head>
        <title>Website Title</title>
      </head>
      <body>
      <h1>HTML TUTORAIL</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
     <h1>What is Lorem Ipsum?</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
     <h1>What is Lorem Ipsum?</h1>
        <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. </p>
      </body>
    </html>
    
  • Output of the above HTML Code:
  • HTML TUTORAIL

    Lorem Ipsum is simply dummy text of the printing and typesetting industry.

    What is Lorem Ipsum?

    Lorem Ipsum is simply dummy text of the printing and typesetting industry.

    What is Lorem Ipsum?

    Lorem Ipsum is simply dummy text of the printing and typesetting industry.

Murach's HTML5 and CSS3, 4th Edition

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

07 May 2017

What is HTML (Hyper Text Markup Language)



  • HTML stands for Hyper Text Markup Language.
  • HTML is the standard markup language for creating Web pages of websites.
  • HTML declare the layout structure of Web pages using markup language code.
  • HTML markup are written by tags (h1, h2 for heading ,p for paragraph and so on)
  • Web Browsers like Mozilla Firefox, Google Chrome , Internet Explorer etc are used to show HTML output.
  • When we visit a website such as http://www.facebook.com we see the output of html code that was written for facebook.
  • Web browsers render the html source code to human readable format which is displayed as images, text,multimedia contents. 
  • Beside html, CSS , JavaScript are also use within a html page.
browsers
Web Browsers are Used to Show HTML Output

HTML: A Beginner's Guide, Fifth Edition

26 September 2016

Write a program in Java to show all files and directory name of a given location




Solution: 
If you want to run this Java program, you have to do the following:
  • Step1: Your computer must have JDK installed to run and compile any Java program.
  • Step2: Create a file name DirfileList.java with the source code given bellow and save the file on any location on your computer.
  • Step3: Compile and  Run the java program to get the output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class DirfileList {

    public static void main(String[] args) {
        // TODO code application logic here

        try {
            // Set directory path name 
            File path = new File("F:/test");

            // Get list of files
            File[] listOfFiles = path.listFiles();

            // Declare file name list
            List<String> file_names = new ArrayList<String>();

            // Declare directory name list
            List<String> dir_names = new ArrayList<String>();

            // Loop throw the files and directory name and store the names in List
            for (int i = 0; i < listOfFiles.length; i++) {

                if (listOfFiles[i].isFile()) {
                    file_names.add(listOfFiles[i].getName());
                } else if (listOfFiles[i].isDirectory()) {
                    dir_names.add(listOfFiles[i].getName());
                }
            }

            // Print file names
            for (String fName : file_names) {
                System.out.println("File:" + fName);
            }

            // Print directory names
            for (String dName : dir_names) {
                System.out.println("Directory:" + dName);

            }
        } catch (Exception e) {
            System.out.println("!! Error:" + e.toString());
        }

    }

}

Java: A Beginner's Guide, Sixth Edition

01 June 2016

What is JavaServer Faces (JSF) in Java programming language ?

  • JSF is a component-based MVC(Model View Controller) framework which enables you to completely separate Java code from HTML pages. 
  • It is a new technology for developing server-side Web applications using Java.
  • For example: to display a table with rows and columns you can add a table component to a page, there is no need to write html table , tr ,td tags with loop structure to show table data in JSF.



  • JSF has the following parts:
  • A set of user interface components(HTML tags, form, table, JSF component)
  • An event-driven programming model
  • A component model that enables third-party developers to supply additional components
  • The application developed using JSF is easy to debug and maintain.

Core JavaServer Faces (3rd Edition)
Mastering JavaServer Faces (Java)

29 May 2016

What do you mean by Exception handling in programming language?


  • An exception is an error that occurs at run time. 
  • Run time errors are errors that cause a program to terminate abnormally. 
  • Run time errors occur while a program is running if the environment detects an operation that is impossible to carry out.
  • Most of the well known computer programming language like Java, C++ have exception handling  mechanism by which a programmer can handle run-time errors of the program. 
  • Some common exceptions are divide-by-zero or file-not-found etc.

Programming Languages
Error Types, Systematic Debugging, Exceptions

21 April 2016

What is Inheritance in OOP(Object Oriented Programming) ?


  • Inheritance is the process by which one object can acquire the properties of another object.
  • In reality as Children get properties from Parents. Similarly in OOP(Object Oriented Programming) using inheritance a Child class can extends the data and member from its parent class.
  • There are various types of inheritance, based on paradigm and specific language.
Inheritance



  1. Single inheritance : Where subclasses inherit the features of one super class. A class acquires the properties of another class.  
    Single Inheritance
  2. Multiple inheritance: Where one class can have more than one super class and inherit features from all parent classes. 
    Multiple Inheritance
  3. Multilevel inheritance : Where a subclass is inherited from another subclass. Hierarchical inheritance: Where one class serves as a superclass (base class) for more than one sub class. 
    Multilevel Inheritance
  4. Hybrid inheritance: a mix of two or more of the above types of inheritance.

Object-Oriented Programming in C++ (4th Edition)
Object-Oriented Programming for Dummies

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