"PHP 산술 연산자"의 두 판 사이의 차이

잔글
 
(다른 사용자 한 명의 중간 판 2개는 보이지 않습니다)
33번째 줄: 33번째 줄:
| **  
| **  
|| Exponentiation || [[거듭제곱]] || $a ** $b
|| Exponentiation || [[거듭제곱]] || $a ** $b
|align='left'| $a의 $b승 ( PHP 5.6에 도입됨 )
|align='left'| $a의 $b제곱 ( PHP 5.6에 도입됨 )
|}
|}


==예시==
==예시==
<source lang='php'>
<syntaxhighlight lang='php'>
<?php
<?php
$a = 9;
$a = 9;
51번째 줄: 51번째 줄:
# float(2.25)
# float(2.25)
# int(1)
# int(1)
</source>
</syntaxhighlight>


==같이 보기==
==같이 보기==
57번째 줄: 57번째 줄:
*[[산술 연산자]]
*[[산술 연산자]]


==참고 자료==
==참고==
*http://php.net/manual/kr/language.operators.arithmetic.php
*http://php.net/manual/kr/language.operators.arithmetic.php
*http://www.w3schools.com/php/php_operators.asp
*http://www.w3schools.com/php/php_operators.asp

2022년 4월 2일 (토) 09:14 기준 최신판

1 개요[ | ]

PHP Arithmetic Operators
PHP 산술 연산자
PHP 계산 연산자
연산자 영어 한국어 예시 설명
+ Addition 덧셈 $a + $b $a와 $b를 더함
- Subtraction 뺄셈 $a - $b $a에서 $b를 뺌
- Negation 부정 -$a $a의 부호를 바꿈 (단항연산자)
* Multiplication 곱셈 $a * $b $a와 $b를 곱함
/ Division 나눗셈 $a / $b $a를 $b로 나눔
% Modulus 나머지 $a % $b $a를 $b로 나눈 나머지
** Exponentiation 거듭제곱 $a ** $b $a의 $b제곱 ( PHP 5.6에 도입됨 )

2 예시[ | ]

<?php
$a = 9;
$b = 4;
var_dump( $a + $b );
var_dump( $a - $b );
var_dump( $a * $b );
var_dump( $a / $b );
var_dump( $a % $b );
# int(13)
# int(5)
# int(36)
# float(2.25)
# int(1)

3 같이 보기[ | ]

4 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}