Jump to content

Is there a funciton to parse strings?


Recommended Posts

What exactly do you want to do with the string? Almost everything you can think about to do with them, can be done in PHP :)Is sprintf() what you want? It formats any string to another string according to a pattern.Or do you mean changing the data type by settype()?

Link to post
Share on other sites
im not sure if i understood you. something like this:
<?php$str = "hello world";$int_from_str = (int) $str;?>

Oh I didn't realize you can cast in PHP lol. Anyway what I mean is to convert a str to a literal integer. So for example:$str = "123";$num = somefunction($str); //parse the string literal into an integer.$num = 123
What exactly do you want to do with the string? Almost everything you can think about to do with them, can be done in PHP :)Is sprintf() what you want? It formats any string to another string according to a pattern.Or do you mean changing the data type by settype()?

I'm not sure what this fuction does, I read the examples but did't really understand it heh.
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...
×
×
  • Create New...