Now that you know how to create strings in PHP, it’s time to try out some basic string operations. In this tutorial you learn how to:
- Join strings together
- Find out the length of a string, and
- Read and change individual characters within a string.
Matt Doyle | Elated Communications
Web and WordPress Development
Client and server-side programming. Covers JavaScript, PHP, Perl and ASP.
See also:Now that you know how to create strings in PHP, it’s time to try out some basic string operations. In this tutorial you learn how to:
A string in PHP is any sequence of characters. Here are some examples of strings:
Hello, world!
abc123
#@@$%&*%
PHP lets you work with strings in many different ways. For example, you can search a string for a piece of text; extract characters from a string; and format a string to make it easier to read or use.
In this tutorial you learn how to create strings in your PHP scripts. You look at:
PHP loops allow you to run the same chunk of code repeatedly. PHP features while
and do...while
loops, which are handy for general-purpose looping, and the more specialized for
loop, which is useful when you want to run a chunk of code a known number of times.
This article explains how PHP for
loops work, and shows you some practical for
loop examples.
PHP loops let you run a block of PHP code over and over again. They’re great for repetitive tasks such as reading data records from a database, or displaying rows of a table in a Web page.
The PHP while
loop is the simplest type of loop to understand. In this article you look at the syntax of a PHP while
loop, and explore some example loops. You also look at do...while
loops.
The PHP if
and else
statements let a script decide whether to run a chunk of code based on a condition. The if
statement runs a chunk of code if the condition is true or skips it if the condition is false. if
combined with else
runs one chunk if the condition is true, or the other chunk if the condition is false.
PHP lets you take things further, and chain several decision-making blocks together, with each block having its own condition to test. To do this, you use the elseif
statement.
The PHP if
statement lets a script test to see if a certain condition is true, and run a chunk of code if it is. This allows your code to make decisions about what to do next, thereby adding a lot of power to your scripts.
[Read more…] about Making Decisions with the PHP if Statement
So you want to know how to make a website. Where do you begin? This article walks you through the basic steps:
Like most languages, PHP lets you add comments to your code. Comments are chunks of text that are ignored when the code is run by the PHP engine, but which are useful to programmers who need to read the code.
In this article you learn how to create PHP comments, and look at some good commenting practices, including how to write and format comments effectively. You also find out how to use comments to “comment out” chunks of PHP code.
Centring things horizontally with CSS is straightforward once you learn a couple of techniques. In this article you learn how to centre any type of content, such as a block of text, an image, a table, a div
element, or an entire page, all using CSS.
Like many programming languages, HTML lets you embed comments within your Web pages. A comment is a piece of text intended just for people to read; Web browsers ignore any HTML comments embedded in a page.
Copyright © 1996-2024 Elated Communications. All rights reserved.
Affiliate Disclaimer | Privacy Policy | Terms of Use | Service T&C | Credits