Jump to content


Photo

PHP Function List


  • Please log in to reply
4 replies to this topic

#1 otuatail

otuatail
  • Members
  • PipPipPip
  • Advanced Member
  • 960 posts

Posted 17 May 2006 - 01:03 PM

I have been looking for a refernce type of all the functions available in php. I want to iterate through a string and as PHP is C based, Thought of something like
$char = $mystring[$x];

I also need to construct a Select Case:


Any help on this please. I might be new to PHP but have used C and C++ extensivly.

Desmond.


#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 17 May 2006 - 01:10 PM

There is a function reference over at php.net.

As for iterating through a string, you have the right idea - Just to expand on it though...
<?php
$str = "The quick brown fox jumped over the lazy dog";
for($i=0; $i<strlen($str); $i++) {
    echo $str[$i]."<br/>";
}
?>
The above will go through the whole of $str and print each character on a new line...
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]I also need to construct a Select Case:[/quote] I don't understand what you mean, care to elaborate?

EDIT: I just done a search on Google for Select Case, and it appears that its equivilent in PHP is the switch statement, used like this:
<?php
$number = 1;
switch($number) {
    case 0:
        echo "Number is zero";
        break;
    case 1:
        echo "Number is one";
        break;
    default :
        echo "Number is not zero or one";
}
?>


#3 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 17 May 2006 - 01:36 PM




Strings

[a href=\"http://in.php.net/manual/en/ref.strings.php\" target=\"_blank\"]http://in.php.net/manual/en/ref.strings.php[/a]

Select case : it is similar to C.

hth
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#4 otuatail

otuatail
  • Members
  • PipPipPip
  • Advanced Member
  • 960 posts

Posted 17 May 2006 - 02:55 PM

Thanks for the help that works fine now. Is there a comprehensive list of functions on this site or any other for all functions like int strcmp(str , str)

Desmond.


#5 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 17 May 2006 - 03:01 PM

[!--quoteo(post=374670:date=May 17 2006, 10:55 AM:name=otuatail)--][div class=\'quotetop\']QUOTE(otuatail @ May 17 2006, 10:55 AM) View Post[/div][div class=\'quotemain\'][!--quotec--]
Thanks for the help that works fine now. Is there a comprehensive list of functions on this site or any other for all functions like int strcmp(str , str)

Desmond.
[/quote]

did you look at the [a href=\"http://in.php.net/manual/en/ref.strings.php\" target=\"_blank\"]manual page[/a] linked above? scroll down the page just a little bit, and there is a comprehensive list of all string functions. plus, each links to the API for easy incorporation.

also, once you go to a string function API page, if you look in the left column, a full listing of all associated functions is updated there.
You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users