Msh Handles Data Types Differently


Recommended Posts

I am not sure if other language behave like this, but I thouhgt this was interesting.

lets say I make a varibale as a string

msh>$a = "3"
msh>$a + 4
msh>34  #it concatenates them, like two strings

but if I put a number first in the statemnet, it treats them both as integers

msh>$a = "3"
msh>4 + $a
msh>7  #this time it treated them both as integers

so if you want to add a bunch of strings as integers, you do it like this

msh>$a = "3"
msh>$b = "5"
msh>0 + $a + $b
msh>8

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...