Wednesday, February 24, 2010

PHP: [Strings] Heredoc and Nowdoc


While reviewing PHP, I just discovered two new ways to handle strings.The heredoc and nowdoc.

Heredoc behaves like a double-quoted string and values inside are being parsed. You can use heredoc for embedding HTML codes.

sample:


<?php

$strString=<<< EOS
some strings
another line
EOS;

echo $strString;

?>



output:


some strings another line


the output is printed in 1 line because i didn't put a < br > in the sample codes.


Nowdoc behaves like single-quoted strings and no parsing is done inside a nowdoc.Nowdoc is good for embedding PHP code or other large blocks of text without the need for escaping.

sample:


<?php

$name="mel";
$month=2;

echo <<<'EOS'
Hi my name is $name.
My blog is $month months old.
EOS;
?>



output:


Hi my name is $name.
My blog is $month months old.



For further reading please visit http://php.net/manual/en/language.types.string.php

Sunday, February 21, 2010

A Quote from Prince William

“I'm not an over-dominant person. I don't go around and expect everyone to listen to me the whole time. But I like to be in control of my life because I have so many people around me, I can get pulled in one direction and then the other. If I don't have any say in it, then I end up just losing complete control and I don't like the idea of that. I could actually lose my identity.”

- Prince William



This is one of my favorite quotes. It's true that there are so many people around us, they can influence us in different ways.. it can be good or bad. Some will just listen while others may dictate. What important is Be Yourself , do whatever you want that will make you feel Happy without the expense of hurting others. Our families and friends will always be there to support and understand us. We must not also forget..

We are the Captain of our own LIFE. bon Voyage!

Friday, February 19, 2010

PHP: [Warning] session_start(): Cannot send session cookie - headers already sent by

I'm trying to review my PHP knowledge by creating a new simple web application. I know PHP is a bit different from Java but PHP is much easier to use in creating a Web application. Last night, i tried to run one of my old applications named sbp and i got this error:


[Warning] session_start(): Cannot send session cookie - headers already sent by


My SBP app is a simple registration, this was running 6 years ago. My pc OS before was Windows 2000 and i was using XAMPP, PHP version 5 and mySQL. Right now, my pc OS is Windows XP. I searched google and it said that there should be no print outputs and blank lines before calling session_start(). Is this a new rule? I also remember that my app was running perfectly in Linux ( again 6 years ago). It worked perfectly even there were "echo" statements before calling session_start(). I'm still wondering why this error occur? I know I'm too outdated. Are there any issues or new rules regarding PHP running in Windows XP?

Wednesday, February 17, 2010

February 17, 2010: A very special day for my Mom

February 17 is my mom's special day. I would just like to greet her:


Happy Happy Birthday Mama!!!
Love you!



Hope you like the foods from Zhu and the Blue Bunny Ice cream plus your new mobile phone (courtesy of my younger sister). ^_^

Wednesday, February 10, 2010

Movie Review: Cloudy with a Chance of Meatballs




Category: Animation
Genre: Childrens
Rated: PG
Review: I watched this movie in 3D last Sunday. I had fun watching it, i felt that i became a kid again for 90 minutes. Watching it made me feel hungry and full at the end of the movie. Love the 3d animation.. the raining of foods, the Gelo palace and the cutee characters. The storyline is simple but it has some good lessons in life.

Cloudy with a Chance of Meatballs is a good movie to unwind and laugh. Kids will definitely enjoy. Better watch this in 3D.

Tuesday, February 9, 2010

My dinner.. breakfast meal

This was my first time to try Eggs Ben for my dinner at Coffee Bean. They offer an all day breakfast set with your choice of coffee, tea of juice. Eggs Ben has a Rosemary Foccacia bread with cheese, Turkey ham, poached egg, Hollandaise sauce, another 2 slices of bread, some butter and jam, stewed fruits and a cup of coffee for php229. An additional of php50 for the coffee upgrade. I upgraded mine to Cafe Latte. Although it is a bit pricey, it's all worth it and delicious.




Tuesday, February 2, 2010

Dulce de Leche Cake

Currently, I'm craving for Red Ribbon's Dulce de Leche Cake. The last time I ate this was Jack's birthday celebration at the office.

Based from Red Ribbon's web site http://www.redribbonbakeshop.com.ph
:

Dulce de Leche

Heavenly layers of white chiffon cake with custard cream filling, enrobed in luscious sweetened milk and caramel icing. Wrapped in fine toasted chiffon crumbs and laden with a frosted caramel crystal layer: Gloriously crowned with white cream rosettes and chocolate spirals.

Regular - PHP 520.00
Junior - PHP 315.00




Monday, February 1, 2010

Taking IT to the Cloud

As we all know, Cloud Computing is the latest trend nowadays in IT. But Cloud Computing is very broad and vague in terms of definition that is why I'm so curious about it. Based from my research, a lot of companies have plans to move to the cloud because it offers a lot especially in business financial terms. A lot of cloud computing service providers offers a pay-per-use service. You will be billed based from the bandwidth you use.. it is cheaper than setting up your own infrastructure. But before moving your infra to the cloud, you should consider several risks such as data security and integrity, disaster recovery and etc. So better do some research. I really wanted to try Cloud Computing.. to have a hands-on experience in setting up an application so I can better understand it. Unfortunately, I don't have the means to get myself an account.. i wish there's a free account. I'm very thankful that there's an internet and google search. I found Thomas Bittman's blog very helpful. His blog gives a lot of information about cloud computing and it is worth reading for.

You might also like:


Related Posts Plugin for WordPress, Blogger...