Thursday, June 28, 2012

php functions on strings

The following are some functions which can be used on strings in php.
  1. str_word_count :- str_word_count has different results depending on parameters.
    • str_word_count($string_variable) returns the word count
    • str_word_count($string_variable, (0,1 or 2)) where
      • 0 returns the word count(the default option)
      • 1 returns an array
      • 2 returns an associative array
    • str_word_count($string_variable, (0,1,2), ' (something to be included as a word for ex '.!&' ').
      • different arguments included next to each other.
  2. str_shuffle($string_variable) :- shuffles string_variable
  3. substr($string_variable,  starting position, ending position) :- returns the substring
  4. strlen($string_variable) :- returns the length of the string_variable
  5. strtolower($string_variable) :- returns $string_variable with all characters in lower case
  6. strttoupper($string_variable) :- returns $string_variable with all characters in upper case 


Tuesday, June 26, 2012

Ruby On Rails...



despite being all set for php, I decided to change gears and opt for the relatively newer and rather more exciting ruby on rails framework. After installing it on my Ubuntu machine which isn't that too complicated, I started following this book http://ruby.railstutorial.org/chapters/beginning#top by Michael Hartl.


I reached around chapter 8 only to realize that copying and pasting stuff wasnt really turning out to be helpful as I had hoped it would be. Therefore I am now going to do stuff from the scratch avoiding the book as much as possible. 

UPDATE :- I am now back to php, seeing that the syntax of it confused me pretty much!