Magento Expert Forum - Improve your Magento experience

Results 1 to 5 of 5

PHP Tutorial for Beginners - Part 1

  1. #1
    Moderator shunavi's Avatar
    Join Date
    Mar 2013
    Posts
    124
    Thanks
    9
    Thanked 26 Times in 17 Posts

    Lightbulb PHP Tutorial for Beginners - Part 1

    PHP is an excellent server-side technology for dynamic webpage generation. Within a span of few years, it has gained immense popularity among developers. This excellent 5-Part tutorial written by Luigi Arlotta explains the basics of PHP programming. His style is so simple that even absolute beginners would have no trouble following this tutorial.

    This tutorial is targeted at those users who may have never programmed using any language before. Also programmers who have experience in other languages can quickly browse through this series and get their PHP code running within minutes...


    Introduction

    PHP stands for "PHP: Hypertext Preprocessor". PHP is a scripting language through which you can generate web pages dynamically. PHP code is directly inserted in HTML documents through specific TAGs declaring the code presence and then executed when a client demands the page. PHP is a server-side language, that's to say that PHP code is directly executed by the server, while the client receives processed results as an HTML document. This way of working is different from that of other scripting languages as JavaScript, whose code is first loaded onto the client machine and then executed by the client (the browser).

    A few points to note about PHP programming -

    1. All compatibility problems existing between different browsers are completely solved. The Client's browser, receives a normal HTML page after the execution of a PHP code on the server, and so it is always able to display it correctly since it deals with only HTML. This does not happen with scripting languages interpreted by the client's browser. In this case the client downloads the script code and tries to process it on the local machine. This procedure works correctly only if the client is equipped with the right software (generally called plugins or built-in support in the browser).

    2. The server side code processing sees to it that the script code is never visible to the clients. That prevents "thefts" of source code.

    3. The server side code execution requires that your webserver has been well configured. It must be able to recognize HTML documents containing PHP code. In order to make this, it is necessary to install a PHP engine and to edit some lines in the webserver's configuration file.

    4. Server side code processing needs resources (CPU time) for generating the dynamic pages. A high number of client requests could overload the server. But generally today's servers such as Apache are made stable enough to handle a relatively large number of clients.

    To make the webserver differentiate between HTML documents containing PHP code and normal HTML pages, .php, .php4 or .phtml extensions are used in place of the .html . These extensions can change according to the webserver configuration. We shall stick to the standard .php extension.

    Assume that a client requests the following page (example1.php). The source code for the file is shown below

    PHP Code:
    <HTML> 
    <BODY> 
    <? 
    echo ("<H1>This is an example</H1>"); 
    ?> 
    </BODY> 
    </HTML>
    This page will be recognized, thanks to the extension from which it is characterized and it will be processed as a HTML document containing PHP code by the server. The code is interpreted before the output is sent to the client. The webserver passes this page through the PHP engine which processes it and executes the PHP instructions in the code. It then substitutes the result of the execution in place of the original PHP code. Once processed by the PHP engine, the webserver then transmits this dynamically generated page to the client. The client receives the following HTML document

    HTML Code:
    <HTML> 
    <BODY> 
    <H1>This is an example</H1> 
    </BODY> 
    </HTML>

    As you see, in the document sent by the web server to the client there is no sign of PHP code. The code has been interpreted/processed and replaced with HTML lines. The client will never be able to deduce what code generated the particular HTML lines.

    PHP instructions are placed inside special TAGs <? and ?>

    These tags allow the PHP engine to distinguish the PHP syntax from the rest of the document. It is possible to use different TAGs editing the engine configuration file php.ini . We shall stick to the most common ones - the ones shown above.

    Necessary Setup to Run PHP on your machine

    To start writing and testing your PHP scripts you need a webserver and a PHP engine. The PHP engine must be combined with the webserver so that the webserver can process the PHP code in your pages. As far as webservers are concerned, on the Linux platform - Apache rules. It is probably the most used webserver at the moment. You can download Apache from www.apache.org. The PHP engine (release 3 or 4) can here be downloaded from www.php.net

    You could learn how to configure Apache to run PHP with the help of the manual that you would be provided or you could search for articles on Tips For Linux itself.

    First steps

    My first PHP script consists of the classic program that displays the famous " HELLO WORLD ". Copy the code shown below, paste and save it in a file with the name helloworld.php in your webserver standard directory (or in the webserver's php files directory).

    PHP Code:
    <HTML> 
    <BODY> 
    <? 
    echo ("<H1>Hello World!</H1>"); 
    ?> 
    </BODY> 
    </HTML>
    Then start your web browser and type the following in the address bar -

    Code:
    http://127.0.0.1/helloworld.php
    or

    Code:
    http://127.0.0.1/~username/helloworld.php

    Note : In case you have not yet configured Apache Server you could read Article No. 29 which explains Apache Server's configuration. Once you Apache Server is configured, you could continue with this article.

    If it works correctly you can proceed and read the rest of this tutorial, otherwise you would have to do some more tweaking and get PHP configured on your machine. If you can't solve the problem, before abandoning, try to have a look to the software documentation. Even try posting your problem on discussion forums on the Web. You will definitely find a solution.

    Variables

    A variable is a block of memory, accessible through a name chosen by the software developer, in which a value is stored. This value, is usually given a default value at the beginning of the application, and you can change that value during the execution of the program. PHP requires variable names to begin with the dollar ' $ ' character.

    Variable names can be composed of uppercase and lowercase letters, digits and underscores. But it is not possible to include spaces or other special or reserved characters to define the names of a variable. Remember that PHP is a case-sensitive language. This means it distinguishes between uppercase and lowercase variable names. For instance, if we write the following script. The code below shows the case sensitive aspect of PHP.

    PHP Code:
    <HTML> 
    <HEAD>
    </HEAD> 
    <BODY> 
    <? 
    $VAR1 = 5; 
    echo ($var1); 
    ?> 
    </BODY> 
    </HTML>
    We'll get an error message because the PHP interpreter does not find $var1 variable (The variable defined initially was $VAR1).

    A script involving variable declarations and displaying the values of those variables is shown below. Read it carefully because it contains some important points that we will discuss later.

    PHP Code:
    <HTML> 
    <BODY>
    <? 
    $website = "http://www.bitafterbit.com"; 
    echo ("<BR>Surf to: $website"); 
    echo ('<BR>Surf to: $website'); 
    ?> 
    </BODY> 
    </HTML>
    The program defines and prints the variable $website. Observe that in the echo() function, whose purpose is to write a string on the screen, two different kinds of inverted commas are used - they are the single and double ones.

    Important : In this tutorial we will refer to the double inverted commas (") as only inverted commas and we will refer to single inverted commas (') as only quotes. The main difference between these two types of syntax is that PHP interprets what is enclosed in the inverted commas, while everything appearing between quotes is considered a constant value and it is not interpreted.

    The example given above produces the following output


    Code:
    Surf to: http://www.bitafterbit.com 
    Surf to: $website
    The text $website is in fact interpreted and replaced with the value of the corresponding variable only in the first echo() statement. This because in the first statement we have used inverted commas to enclose the text to print. The result of this first instruction is

    Code:
    Surf to: http://www.bitafterbit.com
    As explained previously, in the second echo() statement, where quotes have been used in place of inverted commas, the enclosed text is not interpreted, because it is considered to be a constant. The output of the second echo() instruction therefore is

    Code:
    Surf to: $website
    It is important to take notice of this important characteristic of PHP. It is different from other programming languages where all that appears enclosed between inverted commas is considered a constant value (a string). We will talk about strings in detail in later articles when we'll discuss PHP's datatypes.

    View more threads in the same category:


  2. #2
    New member
    Join Date
    Mar 2014
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    I know a very good website for you to learn to code. It's http://cocademy.com
    You can learn very much useful background-knowledge. And it's really easy.

    Magento Reward Points | Magento SEO Extension | Magento Shop By Brand

  3. #3

  4. #4
    Junior Member
    Join Date
    Dec 2019
    Posts
    344
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Hiện tại, đặt cược trá»±c tuyến Ä‘ang dần phổ biến rá»™ng rãi ở nhiá»u khu vá»±c trên Thế giá»›i. Trong đó, Fun88 được cho là nhà cái có Ä‘á»™ chất lượng hàng đầu Châu Ã. Há» cung cấp các trò chÆ¡i từ thể thao cho đến Casino. Vậy link vào Fun88, cụ thể là link vào Fun88 chính thức không qua trung gian 2020 nào chất lượng hãy cùng chúng tôi phân tích qua bài viết sau.

    Tổng quan vỠnhà cái Fun88

    Fun88 được cho là là 1 trong các nhà cái nằm vị trí đứng đầu ở khu vá»±c Châu Ã. chúng ta sẽ không cần lo lắng vá» quá trình thanh toán hay là dối trá, lừa đảo vì các lợi thế sau:

    Pháp lý: Fun88 là một doanh nghiệp được cấp phép kinh doanh hợp pháp tại Philippines thuộc lĩnh vực cá cược Online.

    Giải thưởng Ä‘a dạng: Fun88 đã chiếm được nhiá»u giải thưởng giá trị nhÆ° là “Asian Live Gaming Operator Of The Yearâ€, “Asian Operator 2009†và “Asian Operator 2010â€.

    Äối tác chất lượng: Có thể má»i ngÆ°á»i cảm thấy bất ngá» khi nhà cái Fun88 chính là đối tác của những Câu lạc bá»™ danh tiếng nhÆ° Tottenham, Burnley, Newcastle và từng ký hợp đồng đại sứ thÆ°Æ¡ng hiệu vá»›i huyá»n thoại bóng đá Robbie Fowler, huyá»n thoại bóng rổ Steve Nash và Kobe Bryant (NBA).
    ÄÆ°á»ng dẫn vào nhà cái Fun88 chính thức không qua trung gian 2020

    Tại VN thì để truy cập vào trang chủ Fun88.com thì hầu hết Ä‘á»u bị chặn kết nối do sai địa chỉ IP. Nếu muốn tham gia cá cược thì má»i ngÆ°á»i cần phải chá»n các Ä‘Æ°á»ng dẫn dành riêng cho thị trÆ°á»ng của Việt Nam do chính nhà cái trá»±c tiếp cung cấp. Các địa chỉ đến giao diện chính thức của Fun88 vá»›i ná»™i dung Việt hóa 100%, tất nhiên là Ä‘Æ°á»ng truyá»n của Ä‘Æ°á»ng dẫn này khá nhanh và ổn định:
    Ngoài ra, ngÆ°á»i chÆ¡i còn có thể tá»± Fake IP hoặc đổi DNS để vào trá»±c tiếp Fun88.com cÅ©ng là 1 phÆ°Æ¡ng án để truy cập link vào Fun88 chính thức không qua trung gian 2020. Ưu Ä‘iểm là không cần tìm những Ä‘Æ°á»ng dẫn khác, nhÆ°ng nhược Ä‘iểm là loading trang sẽ chậm hÆ¡n nhiá»u.

    Xem thêm: lịch thi đấu bóng đá hôm nay - soi kèo trực tuyến tại Fun88
    Giao diện của Fun88 thân thiện vá»›i má»i thiết bị

    Äối vá»›i những nhà cái cá cược online thì giao diện là 1 yếu tố thu hút sá»± chú ý của ngÆ°á»i chÆ¡i, cần được đặc biệt quan tâm:

    Giao diện của Fun88 được há»a tiết thân thiện vá»›i tầm mắt của hầu hết ngÆ°á»i chÆ¡i, các thể loại trò chÆ¡i Ä‘á»u được phân chia dá»… thấy rõ ràng, Ä‘iểm đặc biệt là Ä‘á»u được sá»­ dụng ngôn ngữ Việt 100%.

    Thêm vào đó, nhà cái này còn thích ứng cho các thiết bị di Ä‘á»™ng nhÆ° Android hoặc IOS, há»— trợ ngÆ°á»i chÆ¡i có thể đặt cược bất cứ má»i nÆ¡i.

    Cho ra Ä‘á»i Ä‘a dạng nhiá»u loại hình giải trí

    Cá Ä‘á»™ bóng đá: Sau khi đã vào được link vào Fun88 thì ngÆ°á»i chÆ¡i có thể chá»n lá»±a môn “Thể thao†bóng đá nếu yêu mến thể loại này và muốn đặt cược. Hiện, Fun88 luôn bổ sung các giải đấu hấp dẫn nhÆ° NHA, La liga, Giải vô địch bóng đá Äức (Bundesliga), Serie A,...

    Sòng bài online: Những loại hình nhÆ° bài cổ Ä‘iển, blackjack, poker,baccarat... Ä‘á»u có tỉ lệ đặt cược tÆ°Æ¡ng đối cao và được công khai để má»i ngÆ°á»i chÆ¡i cùng biết được kết quả nên sẽ không có khả năng gian lận.
    Bảo mật thông tin ngÆ°á»i chÆ¡i an toàn

    Hiện nhà cái Fun88 Ä‘ang phối hợp vá»›i 1 doanh nghiệp hàng đầu vá» an toàn và bảo mật thông tin nhằm đảm bảo được thông tin ngÆ°á»i chÆ¡i không bị phát tán.

    Riêng nhà cái thì có chính sách bảo mật tuyệt đối, nghiêm ngặt. Các Ä‘oạn mã hóa MD5 và 128 Bit SSL có thể giúp má»i ngÆ°á»i lấy lại thông tin bị hack.

    Khả năng thanh toán đơn giản và mau chóng

    Tất cả các giao dịch trên Fun88 thÆ°á»ng diá»…n ra nhanh chóng là do nhà cái kết hợp vá»›i các Ngân hàng uy tín nhÆ° Äông à Bank, ACB, Vietcombank, Techcombank, Sacombank, Vietinbank và BIDV.

    Ngoài ra, má»i ngÆ°á»i còn có thể thá»±c hiện nạp, rút tiá»n qua Internet Banking, thẻ cào, ví Ä‘iện tá»­, ATM hoặc quầy giao dịch.

    Thá»i gian nạp tiá»n chỉ khoảng 5 – 10 phút và rút tiá»n có thể mất khoảng 30p – 2h vào bất cứ khi nào.

    Xem thêm: Fun88 Casino trá»±c tuyến - Sòng bài trá»±c tuyến uy tín hàng đầu Châu Ã

    Dịch vụ chăm sóc khách hàng vô cùng tốt

    Nhà cái Fun88 hiện Ä‘ang có được 1 nhóm nhân viên tÆ° vấn vô cùng nhiệt tình và chuyên nghiệp bảo đảm sẽ làm ngÆ°á»i chÆ¡i hài lòng.

    Vá»›i thá»i gian há»— trợ 24/7 thì ngÆ°á»i chÆ¡i có thể dá»… dàng Ä‘Æ°a ra câu há»i bất kỳ lúc nào thông qua Zalo, Viber, Email,...

    Luôn luôn có khuyến mãi và ưu đãi lớn xuyên suốt quá trình tham gia

    Äể Ä‘á» cao sá»± hài lòng vá» sản phẩm của quý khách hàng. Fun88 luôn tạo ra các khuyến mãi có nhiá»u sá»± lôi cuốn ngÆ°á»i chÆ¡i nhÆ°:

    Tặng thêm 100% số lượng tiá»n nạp lần đầu khi đăng ký tài khoản.

    Tặng thêm 30% lên đến 2 triệu trên thể thao IM hay 38% nếu nạp lại tiá»n thưởng.

    Hoàn tiá»n không giá»›i hạn 2% khi đặt cược.
    Những ưu điểm và sự thiếu sót mà nhà cái Fun88 đang có

    Ưu điểm: Là nhà cái hợp pháp có giấy hoạt động minh bạch.

    Hoạt động xuyên suốt 24/7.

    Rút và Nạp tiá»n cá»±c nhanh.

    Thông tin bảo mật 100%.

    Khuyến mãi hấp dẫn, phần thưởng dễ lấy.

    Việt hóa 100%.

    Nhược điểm: Không được chơi thử.

    Không có những game cổ điển của Việt Nam như bầu cua, xóc dĩa, bài ba cây,...

    Tóm lại, nhà cái này là sá»± chá»n lá»±a đúng đắn tại Việt Nam khi ngÆ°á»i chÆ¡i có nhu cầu thÆ° giãn có thể tìm đến. Äể có thể trải nghiệm sá»± cuốn hút của trò chÆ¡i thì các bạn hãy bấm vào link vào Fun88 chính thức không qua trung gian 2020 trên để trải nghiệm những giây phút thoải mái nhé.

Similar Threads

  1. Magento Tutorial for Beginners (Part 4)
    By shunavi in forum Webmaster & Administrator
    Replies: 4
    Last Post: 07-04-2021, 06:31 AM
  2. PHP Tutorial for Beginners - Part 5
    By shunavi in forum PHP programming
    Replies: 2
    Last Post: 09-06-2020, 06:00 AM
  3. PHP Tutorial for Beginners - Part 4
    By shunavi in forum PHP programming
    Replies: 1
    Last Post: 14-03-2019, 07:54 AM
  4. PHP Tutorial for Beginners - Part 3
    By shunavi in forum PHP programming
    Replies: 0
    Last Post: 24-05-2013, 04:39 AM
  5. PHP Tutorial for Beginners - Part 2
    By shunavi in forum PHP programming
    Replies: 0
    Last Post: 24-05-2013, 04:34 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •