Tutorial PHP basic variable type

in #utopian-io7 years ago (edited)
Hello Everyone

This is a tutorial about the introduction of PHP

Merhabalar

Bugun sizlere diğer dillerle ve php'nin değişken tipleri hakkında bilgilendirme ve örnekler yapıcam.

Yazılım dillerinde der dilde değişken tipleri bulunmaktadır php dilinde ise bu biraz daha basittir.
alt seviye diller için çok kullanılan değişken tipleri şunlardır.

 String,Double,Float,Int,Char,object vs.

vede her dilde olduğu gibi her kod yazımından sonra noktalı virgül konulur.
python hariç : )( pythonda koymasanız da olur.)
Örneğin birçok alt seviye dilde aşağıdaki gibi string tanımı yaparken.

 
String a  =''I am variable"; // diye tanımlarken 
php için sadece dolar işareti değişken adı yazmak yeterli : )
 $a = "I am variable";
Örneğin birçok alt seviye dilde aşağıdaki gibi number tanımı yaparken.

int a = 0;
 float a=12.5;
php için

$a  = 0;
$a =12.5;
hadi biraz örnek yapalım ve sonucunu görelim. normal şartlarda Phpstorm kullanırım ama küçük projelerde notepad++ veya sublime öneririm.

Eğer oluşturduğunuz bir değişkeni yazdırmak istiyorsanız php'de echo komutunu kullanırsınız.
eğer yazdığınız kodların yan yana gelmesini istemiyorsanız echo "
"; komutunu kullanabilirsiniz.
Aşağıdaki oluşturduğum resimde bir kaç örnek yaptım bunları açıklamak gerekirse
integer bir değeri yani Normal sayılar ile float bir sayıyı yani kesirli sayıyı
direk olarak çarpabilirsiniz.
Eğer alt seviye bir dil kullanmış olsa idiniz bunun için sayılar arası convert yapmak durumda kalabilirdiniz.
aynı zamanda php'de string bir ifadeyi integer bir ifadeyle çarpabilirsiniz her ne kadar anlam ifade etmesede sonuç 0 olucaktır.
pyhtoncular bu konuda şanslı stringle integerı çarptıklarını o ifadeyi integarın değeri kadar yazar : )

aynı zamanda string bir ifadeyle number bir ifadeyi birleştirebilirsiniz php dilinde bunun için nokta ile iki değer birleştirilebilmekte örneğin
$a = "string ifade".2;

variable.jpg

Aşağıda ise yazdığımız kodların sonuçları bulunmaktadır.
variable.jpg

Eğer sormak istediğiniz basit seviyeden ileri düzeye kadar her sorunuzu bilgim dahilince yanıtlarım.
Öğrenmek istediğiniz başka konu var ise burada anlatım yapabilirim.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

This post has received a 0.63 % upvote from @drotto thanks to: @kedimuren.

This post has received a 2.72% upvote from @lovejuice thanks to @kedimuren. They love you, so does Aggroed. Please be sure to vote for Witnesses at https://steemit.com/~witnesses.

This post has received a 0.72 % upvote from thanks to: @kedimuren.
For more information, click here!!!!
Send minimum 0.100 SBD to bid for votes.

Before sending a transfer to @minnowhelper, verify that your publication meets these conditions (http://www.minnowhelper.com/conditions.php). After the transfer is made, no claims will be received.


The Minnowhelper team is still looking for investors (Minimum 10 SP), if you are interested in this, read the conditions of how to invest click here!!!
ROI Calculator for Investors click here!!!

Your contribution cannot be approved because it does not follow the Utopian Rules.

  • Very short, not very informative and similar posts already exists in utopian.
  • The content is low quality.
    You can contact us on Discord.
    **[utopian-moderator]

@resteemator is a new bot casting votes for its followers. Follow @resteemator and vote this comment to increase your chance to be voted in the future!

The @OriginalWorks bot has determined this post by @kedimuren to be original material and upvoted it!

ezgif.com-resize.gif

To call @OriginalWorks, simply reply to any post with @originalworks or !originalworks in your message!

Please note that this is a BETA version. Feel free to leave a reply if you feel this is an error to help improve accuracy.

Coin Marketplace

STEEM 0.15
TRX 0.15
JST 0.028
BTC 53807.82
ETH 2237.98
USDT 1.00
SBD 2.30