본문 바로가기

프로그램&DB/PHP

PHP Looping - While Loops 루프 반복문 PHP Looping - While Loops Loops execute a block of code a specified number of times, or while a specified condition is true. PHP Loops Often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this. In PHP, we have the following looping statements: while - loops .. 더보기
PHP Arrays 일반배열, 다중배열, 배열객체 예문 포함 PHP Arrays An array stores multiple values in one single variable. What is an Array? A variable is a storage area holding a number or text. The problem is, a variable will hold only one value. An array is a special variable, which can store multiple values in one single variable. If you have a list of items (a list of car names, for example), storing the cars in single variables could look like .. 더보기
PHP Switch Statement 제어문 PHP Switch Statement Conditional statements are used to perform different actions based on different conditions. The PHP Switch Statement Use the switch statement to select one of many blocks of code to be executed. Syntax switch (n) { case label1: code to be executed if n=label1; break; case label2: code to be executed if n=label2; break; default: code to be executed if n is different from both.. 더보기
PHP If...Else Statements 제어문 PHP If...Else Statements Conditional statements are used to perform different actions based on different conditions. Conditional Statements Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this. In PHP we have the following conditional statements: if statement - use this statement to execute some .. 더보기
PHP Operators 연산자 PHP Operators Operators are used to operate on values. PHP Operators This section lists the different operators used in PHP. Arithmetic Operators Operator Description Example Result + Addition x=2 x+2 4 - Subtraction x=2 5-x 3 * Multiplication x=4 x*5 20 / Division 15/5 5/2 3 2.5 % Modulus (division remainder) 5%2 10%8 10%2 1 2 0 ++ Increment x=5 x++ x=6 -- Decrement x=5 x-- x=4 Assignment Opera.. 더보기
PHP String Variables 문자열 변수 PHP String Variables A string variable is used to store and manipulate text. String Variables in PHP String variables are used for values that contain characters. In this chapter we are going to look at the most common functions and operators used to manipulate strings in PHP. After we create a string we can manipulate it. A string can be used directly in a function or it can be stored in a vari.. 더보기
PHP Variables 변수 PHP Variables A variable is used to store information. Variables in PHP Variables are used for storing values, like text strings, numbers or arrays. When a variable is declared, it can be used over and over again in your script. All variables in PHP start with a $ sign symbol. The correct way of declaring a variable in PHP: $var_name = value; New PHP programmers often forget the $ sign at the be.. 더보기
PHP Sessions 세션 관련 활용 예제 A PHP session variable is used to store information about, or change settings for a user session. Session variables hold information about one single user, and are available to all pages in one application. PHP Session Variables When you are working with an application, you open it, do some changes and then you close it. This is much like a Session. The computer knows who you are. It knows when .. 더보기