.


:




:

































 

 

 

 


PHP

:

<?php$capital = "Paris"; echo "The capital of France is", $capital,"<br />";?>

. ( ) , . :

<?php$capital = "Paris"; echo "The capital of France is $capital <br />";?>

:

The capital of France is Paris

. :

<?php$text = "news"; echo "Where's the $textpaper <br />";?>

, $text . . textpaper . :

<?php$text = "news"; echo "Where's the {$text}paper <br />";?>

,

PHP , .

<?php$apples = 5; // $apples $fruit = "apples"; /* $fruit, $apples */ // $apples, $$fruit echo " - ", $$fruit;?>

, , : ${$fruit}. :

<?php echo " - ${$fruit}";?> - 5

PHP

, . define, , :

<?phpdefine("pi", 3.14);?>

, .

:

<?phpdefine("pi", 3.14); echo " ", pi;?>

:

3.14

!
PHP, :

 

__CLASS__ __FILE__ __FUNCTION__ __LINE__ __METHOD__
and default endif global print
array die endswitch if require
as do endwhile include require_once
break echo eval include_once return
case else exception isset static
cfunction elseif exit list switch
class empty extends new unset
const enddeclare for old_function use
continue endfor foreach or while
declare endforeach function php_user_filter xor

 

__LINE__

__FILE__

__FUNCTION__

__CLASS__

__METHOD__

PHP_VERSION

PHP

PHP_OS

PHP

DEFAULT_INNCLUE_PATH

, PHP

 

 

PHP

 

PHP , . PHP. , PHP:

  • Boolean. , true false.
  • Integer. (: 4 10 ).
  • String. (: , , ).
  • Float. (: 1.2, 3.14, 8.5498777).
  • Object. .
  • Array. .
  • Resource. (: ).
  • NULL. NULL.
<?php$bool = true; // Boolean$int = 100; // Integer$string = " "; // String$string2 = "5425"; // String, !$float = 44.122; // Float?>

.

, :

<?php$str = "50000"; // String$new_str = (integer) $str; // Integer // ... echo $new_str + $new_str;?>

:

100000

3.

, PHP, : , , .
.
, .
.

 



<== | ==>
. echo. | 
:


: 2018-10-15; !; : 531 |


:

:

- - , .
==> ...

1630 - | 1591 -


© 2015-2024 lektsii.org - -

: 0.015 .