참조 -이 기호는 PHP에서 무엇을 의미합니까?
질문
이게 뭔가요?
이것은 현재 PHP의 구문에 대해 지금 등록한 질문 모음입니다.이것은 또한 커뮤니티 위키이기 때문에 모든 사람들은이 목록을 유지 관리하는 데 참여하도록 초대됩니다.
왜 이런거야?
운영자 및 기타 구문 토큰에 대한 질문을 찾기가 어려웠습니다. 주요 아이디어는 스택 오버플로에 대한 기존 질문에 대한 링크를 가지므로 PHP 설명서에서 콘텐츠를 복사하지 않아도되기 쉽습니다.
참고 : 2013 년 1 월 이후 스택 오버플로는 특수 문자를 지원합니다.검색 용어를 따옴표로 둘러싸고 있습니다.[PHP] "=="vs "==="
내가 여기서 어떻게해야합니까?
그런 질문을했기 때문에 누군가가 여기에서 가리키면 아래의 특정 구문을 찾으십시오.연결된 질문과 함께 PHP 매뉴얼에 연결된 페이지가 귀하의 질문에 답변 할 수 있습니다.그렇다면 대답을 흡입하도록 권장됩니다.이 목록은 제공되는 다른 사람들이 제공하는 데 도움이되는 대신에 의미가 없습니다.
목록
특정 토큰이 아래에 나열되지 않은 경우 파서 토큰 목록에서 찾을 수 있습니다.
& 비트 연산자 또는 참고 문헌
- What does it mean to start a PHP function with an ampersand?
- Understanding PHP & (ampersand, bitwise and) operator
- PHP "&" operator
- Difference between & and && in PHP
- What does "&" mean here in PHP?
- What does "&" mean in this case?
- What does the "&" sign mean in PHP?
- What does this signature mean (&) in PHP?
- How does the "&" operator work in a PHP function?
- What does & in &2 mean in PHP?
- When should I use a bitwise operator?
- Is there ever a need to use ampersand in front of an object? (&$)
= & 참조
- Reference assignment operator in PHP, =&
- What do the "=&" and "&=" operators in PHP mean?
- What do the '&=' and '=&' operators do?
- What does =& mean in PHP?
& = 비트 연산자
&& logical 연산자
- 'AND' vs '&&' as operator
- Difference between & and && in PHP
- Is there any difference between "and" and "&&" operators in PHP?
- PHP - and / or keywords
산술 연산자 %
- What does the percent sign mean in PHP?
- What is the PHP operator % and how do I use it in real-world examples?
!!논리 연산자
@ 오류 제어 연산자
- What is the use of the @ symbol in PHP?
- 'At' symbol before variable name in PHP: @$_POST
- PHP functions and @functions
- Should I use @ in my PHP code?
- What does @ mean in PHP?
? : Ternary 연산자
- What are the PHP operators "?" and ":" called and what do they do?
- ?: operator (the 'Elvis operator') in PHP
- Where can I read about conditionals done with "?" and ":" (colon)?
- Using PHP 5.3 ?: operator
...?NULL COALESCE 연산자 (PHP 7 이후)
?끈 ? int. ?정렬 ? bool. ? float nullable 리턴 유형 선언 (PHP 7.1 이후)
- Nullable return type declaration
- Nullable parameter type declaration
- php method argument type hinting with question mark (?type)
: 제어 구조, TERNARY 운영자, 반환 유형 선언을위한 대체 구문
:: 스코프 해상도 연산자
- What do two colons mean in PHP?
- What's the meaning of the PHP token name T_PAAMAYIM_NEKUDOTAYIM?
- What's the difference between :: (double colon) and -> (arrow) in PHP?
- What exactly are late static bindings in PHP?
- static::staticFunctionName()
- Unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting T_NS_Separator
\ 네임 스페이스
-> 수업 및 개체
- What is the "->" PHP operator called?
- Where do we use the object operator "->" in PHP?
- What's the difference between :: (double colon) and -> (arrow) in PHP?
- What does the PHP syntax $var1->$var2 mean?
- What does "->" mean/refer to in PHP?
=> 배열
^ 비트 연산자
>> Bitwise 연산자
<< 비트 연산자
<<< Heredoc 또는 Nowdoc.
- What does <<<END mean in PHP?
- PHP expression <<<EOB
- In PHP, what does "<<<" represent?
- Using <<<CON in PHP
- What's this kind of syntax in PHP?
= 할당 연산자
== 비교 연산자
- How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
- PHP != and == operators
- The 3 different equals
- Type-juggling and (strict) greater/lesser-than comparisons in PHP
=== 비교 연산자
- What does "===" mean?
- How do the PHP equality (== double equals) and identity (=== triple equals) comparison operators differ?
- The 3 different equals
- Type-juggling and (strict) greater/lesser-than comparisons in PHP
! == 비교 연산자
! = 비교 연산자
- PHP != and == operators
- Is there a difference between !== and != in PHP?
- comparing, !== versus !=
- What is the difference between <> and !=
<> 비교 연산자
- PHP operator <>
- PHP's <> operator
- What is the difference between <> and !=
- Type-juggling and (strict) greater/lesser-than comparisons in PHP
<=> 비교 연산자 (PHP 7.0 이후)
|비트 연산자
- What is the difference between the | and || operators?
- What Does Using A Single Pipe '|' In A Function Argument Do?
||논리 연산자
- What is the difference between the | and || operators?
- PHP - and / or keywords
- What exactly does || mean?
- The behaviour of the or operator in PHP
~ bitwise 연산자
+ 산술 연산자, 배열 연산자
+ = 및 - = 할당 연산자
++ 및 - 연산자 증가 / 감소
. = 과제 운영자
...에문자열 운영자
- Difference between period and comma when concatenating with echo versus return?
- What does a . (dot) do in PHP?
, 함수 인수
, 변수 선언
$$ 변수 변수
- What does $$ (dollar dollar or double dollar) mean in PHP?
- what is "$$" in PHP
- $function() and $$variable
`실행 연산자
= 짧은 열린 태그
[] 배열 (PHP 5.4 이후 짧은 구문)
- PHP arrays... What is/are the meaning(s) of an empty bracket?
- What is the meaning of []
- Php array_push() vs myArray[]
- What does [] mean when reading from a PHP array?
- Shorthand for arrays: literal
$var = []
empty array
... 포장 풀기 인수 (PHP 5.6 이후)
** 지수 (PHP 5.6 이후)
# 한 줄 쉘 스타일의 설명
? -> NullSafe 운영자 호출 (PHP 8.0 이후)
답변
연산자 증가 / 감소
++ 증분 연산자
- 감소 운전자
Example Name Effect
---------------------------------------------------------------------
++$a Pre-increment Increments $a by one, then returns $a.
$a++ Post-increment Returns $a, then increments $a by one.
--$a Pre-decrement Decrements $a by one, then returns $a.
$a-- Post-decrement Returns $a, then decrements $a by one.
이들은 변수 전 또는 뒤에 갈 수 있습니다.
변수 앞에 놓으면 증분 / 감소 조작이 변수로 수행되면 결과가 리턴됩니다.변수 이후에 넣으면 변수가 처음 리턴되면 증분 / 감소 작업이 완료됩니다.
예를 들어:
$apples = 10;
for ($i = 0; $i < 10; ++$i) {
echo 'I have ' . $apples-- . " apples. I just ate one.\n";
}
라이브 예제
++ $ i가 더 빠르기 때문에 ++ $ i가 사용됩니다.$ i ++는 동일한 결과를 가져올 것입니다.
변수를 실제로 증가시키고 그 결과 결과를 반환 한 후에 사전 증분은 조금 더 빠릅니다.사후 증분은 특수 변수를 생성하고 첫 번째 변수의 값을 복사하고 첫 번째 변수가 사용 된 후에 만 값을 대체합니다.
그러나 첫 번째 사과를 사용해야합니다. 먼저 현재 사과 수를 표시하려면 다음을 빼냅니다.
PHP에서 문자를 증가시킬 수도 있습니다.
$i = "a";
while ($i < "c") {
echo $i++;
}
Z에 도달하면 AA가 다음과 같습니다.
문자 변수는 증가시킬 수 있지만 감소하지 않아도 일반 ASCII 문자 (A-Z 및 A-Z) 만 지원됩니다.
스택 오버플로 게시물 :
증분 이해
답변
비트로 연산자
조금 뭐야?비트는 1 또는 0의 표현이지만 기본적으로 꺼짐 (0)과 (1)
바이트 란 무엇입니까?바이트는 8 비트로 이루어지고 바이트의 가장 높은 값은 255이며, 이는 모든 비트가 설정됩니다.바이트의 최대 값이 255 인 이유를 살펴 보겠습니다.
-------------------------------------------
| 1 Byte ( 8 bits ) |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|
-------------------------------------------
이 표현은 1 바이트입니다
1 + 2 + 4 + 8 + 16 + 32 + 64 + 128 = 255 (1 바이트)
더 나은 이해를위한 몇 가지 예제
"and"연산자 : &
$a = 9;
$b = 10;
echo $a & $b;
이것은 번호 8을 출력합니다. 왜?우리의 표 예제를 사용하여 보자.
-------------------------------------------
| 1 Byte ( 8 bits ) |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|
-------------------------------------------
| $a | 0| 0| 0| 0| 1| 0| 0| 1|
-------------------------------------------
| $b | 0| 0| 0| 0| 1| 0| 1| 0|
-------------------------------------------
| & | 0| 0| 0| 0| 1| 0| 0| 0|
-------------------------------------------
따라서 테이블에서 함께 볼 수있는 유일한 비트는 8 비트입니다.
두 번째 예제
$a = 36;
$b = 103;
echo $a & $b; // This would output the number 36.
$a = 00100100
$b = 01100111
두 개의 공유 비트는 32 및 4입니다.
"또는"연산자 : |
$a = 9;
$b = 10;
echo $a | $b;
이것은 번호 11을 출력합니다. 왜?
-------------------------------------------
| 1 Byte ( 8 bits ) |
-------------------------------------------
|Place Value | 128| 64| 32| 16| 8| 4| 2| 1|
-------------------------------------------
| $a | 0| 0| 0| 0| 1| 0| 0| 1|
-------------------------------------------
| $b | 0| 0| 0| 0| 1| 0| 1| 0|
-------------------------------------------
| | | 0| 0| 0| 0| 1| 0| 1| 1|
-------------------------------------------
8, 2 및 1 열에 3 비트 세트가 있음을 알 수 있습니다.up : 8 + 2 + 1 = 11을 추가하십시오.
답변
<=> 우주선 연산자
PHP 7에 추가됨
우주선 연산자 <=>는 PHP 7에 추가 된 최신 비교 연산자입니다. 평등 연산자 (==,! =, ===,! ==)로 동일한 우선 순위가없는 비 연관성 바이너리 연산자입니다.이 연산자는 왼쪽과 오른쪽 피연산자 간의 간단한 3 방향 비교를 허용합니다.
운영자는 정수의 표현식을 가져옵니다.
두 피연산자가 모두 동일하면 0입니다 왼손 피연산자가 오른손 피연산자보다 작 으면 0 미만 왼손 피연산자가 오른손 피연산자보다 큰 경우 0보다 큰
예를 들어,
1 <=> 1; // 0
1 <=> 2; // -1
2 <=> 1; // 1
이 운영자를 사용하는 좋은 실제 적용은 두 값 사이의 3 방향 비교를 기반으로 0, 음수 또는 양의 정수를 반환 할 것으로 예상되는 비교 유형 콜백입니다.USORT로 전달 된 비교 함수는 하나의 예입니다.
PHP 7 이전에 당신은 쓸 것입니다 ...
$arr = [4,2,1,3];
usort($arr, function ($a, $b) {
if ($a < $b) {
return -1;
} elseif ($a > $b) {
return 1;
} else {
return 0;
}
});
PHP 7 이후로 쓸 수 있습니다 ...
$arr = [4,2,1,3];
usort($arr, function ($a, $b) {
return $a <=> $b;
// return $b <=> $a; // for reversing order
});
답변
getText 용 _ 별칭 ()
_ ()와 같이 밑줄 문자 '_'는 getText () 함수에 대한 별칭입니다.
답변
Syntax | Name | Description |
---|---|---|
x == y |
Equality | true if x and y have the same key/value pairs |
x != y |
Inequality | true if x is not equal to y |
x === y |
Identity | true if x and y have the same key/value pairsin the same order and of the same types |
x !== y |
Non-identity | true if x is not identical to y |
x <=> y |
Spaceship | 0 if x is equal to y, greater than 0 if x > y, less than 0 if x < y |
++x |
Pre-increment | Increments x by one, then returns x |
x++ |
Post-increment | Returns x, then increments x by one |
--x |
Pre-decrement | Decrements x by one, then returns x |
x-- |
Post-decrement | Returns x, then decrements x by one |
x and y |
And | true if both x and y are true . If x=6, y=3 then(x < 10 and y > 1) returns true |
x && y |
And | true if both x and y are true . If x=6, y=3 then(x < 10 && y > 1) returns true |
x or y |
Or | true if any of x or y are true . If x=6, y=3 then(x < 10 or y > 10) returns true |
x || y |
Or | true if any of x or y are true . If x=6, y=3 then(x < 3 || y > 1) returns true |
a . b |
Concatenation | Concatenate two strings: "Hi" . "Ha" |
답변
Magic Constant : 이들은이 토큰 가족의 중요한 부분이지만 중요한 부분이 아닙니다.사용되는 위치에 따라 변경되는 8 가지 마법의 상수가 있습니다.
__line__ : 파일의 현재 행 번호입니다.
__file__ : 파일의 전체 경로 및 파일 이름입니다.포함 내에서 사용하는 경우 포함 된 파일의 이름이 반환됩니다.PHP 4.0.2, __file__은 항상 심볼릭 링크가 해결 된 절대 경로를 포함하고 있지만 일부 상황에서는 상대 경로가 포함되어 있습니다.
__dir__ : 파일의 디렉토리.포함 내에서 사용되는 경우 포함 된 파일의 디렉토리가 리턴됩니다.이것은 dirname (__ 파일 __)과 같습니다.이 디렉토리 이름은 루트 디렉토리가 아닌 경우 트레일 링 슬래시가 없습니다.(PHP 5.3.0에 추가됨)
__function__ : 함수 이름.(PHP 4.3.0에 추가) PHP 5 현재이 상수는 선언 된 함수 이름을 반환합니다 (대소 문자 구분).PHP 4에서 그 값은 항상 소지됩니다.
__class__ : 클래스 이름.(PHP 4.3.0에 추가) PHP 5 현재이 상수는 선언 된 클래스 이름을 반환합니다 (대소 문자 구분).PHP 4에서 그 값은 항상 소지됩니다.클래스 이름에는 (예 : foo \ bar) 선언 된 네임 스페이스가 포함됩니다.PHP 5.4 __class__는 특성에서도 작동합니다.특성 방법에서 사용될 때 __class__는 특성이 사용되는 클래스의 이름입니다.
__trait__ : 특성 이름.(PHP 5.4.0에 추가) PHP 5.4 현재이 상수는 선언 된 특성을 반환합니다 (대소 문자를 구분).형질 이름에는 (예 : foo \ bar) 선언 된 네임 스페이스가 포함됩니다.
__method__ : 클래스 메소드 이름.(PHP 5.0.0에 추가) 메서드 이름은 선언 된대로 반환됩니다 (대소 문자를 구분).
__namespace__ : 현재 네임 스페이스의 이름 (대소 문자 구분).이 상수는 컴파일 타임에 정의됩니다 (PHP 5.3.0에서 추가).
원천
출처:https://stackoverflow.com/questions/3737139/reference-what-does-this-symbol-mean-in-php
최근댓글