3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $testing = 'Fun for Girls Weekly Web PostingDate of posting: June 6, 2014Author: Mary Richards<-----HFY-----><sub>The Care and Keeping of Friends: How can I support my faraway friend?</sub>I moved away from my best friend a few years ago, but our friendship is still extremely close. I just found out that her parents are getting divorced, and it makes me feel awful that I&rsquo;m not there for my friend. What can I do to help her when I live in another state?<sig>Faraway Friend</sig>Tell her that you&rsquo;re there for her and that you&rsquo;ll do anything you can to help her get through her parents&rsquo; divorce. If she doesn&rsquo;t want to talk about it, don&rsquo;t push her. Give her some time. When she is ready, listen to what she has to say.<sig>Mikayla, age 13, Massachusetts</sig>Can you visit her? You could tell her that you wish you lived closer so that you could help her in tough times.<sig>Sarah, age 9, Georgia</sig>E-mail her pictures and messages every week. Have weekly calls, and let her tell you how she feels about the divorce. Try to support her and comfort her when she tells you about how she feels. If you don&rsquo;t have e-mail, or she doesn&rsquo;t, talk to your parents about how important keeping in touch is to both of you and that having e-mail would be an easy way to do that. Good luck!<sig>Karuna, age 11, California</sig>You could send her a gift through the mail along with a note that says you feel bad about her situation. Or maybe you don&rsquo;t need to say anything about it at all. You know your friend, so think about what she might need to hear in order to feel better. It&rsquo;s different for everyone.<sig>Sarah, age 11, Illinois</sig>Just because you&rsquo;re far away from her in distance doesn&rsquo;t mean that you&rsquo;re far away in spirit. When your friend needs help, help her in the best way you can. Let her know that she can count on you and that you&rsquo;ll always be there for her. Tell your parents, and ask them for ideas. Bet your friend will appreciate any help from you.<sig>An American Girl fan</sig>Write supportive letters, or call your friend on the phone. Just try to talk to her any way you can. It should help.<sig>Anya, age 10, Minnesota</sig>Send your friend something sweet in the mail, such as a friends&rsquo; necklace or a card. It will brighten her day and help her remember that you are always thinking of her.<sig>Maddie, age 10, Ohio</sig>Just because you live somewhere else doesn&rsquo;t mean you can&rsquo;t help, but your friend might need to take her time until she is ready to talk about the divorce. When she is ready to talk, then you can listen.<sig>Leah, age 12, Canada</sig>It&rsquo;s nice to see a friendly face, so when you need to talk to each other, you could have video chats with your friend. I know it&rsquo;s no substitute for the real thing, but at least it&rsquo;s something! Also, make sure your parents know about what&rsquo;s going on. They may be able to help out. Good luck!<sig>Natalie, age 11, Ohio</sig>I had something like this happen with a friend. Her dad moved away and took her with for the summer. We text a lot and send letters. We also make sure to talk about our favorite things. Her favorite thing is writing books, so we wrote a story together over e-mail. We play app games together. I also help her just by checking in with her. Simple questions can help take a person&rsquo;s mind off her problems, so I&rsquo;ll write something like, &ldquo;What did you do today?&rdquo;<sig>Brooke, age 12, Illinois</sig>Do whatever you can&mdash;visit her, set up a video chat, e-mail her, or send letters. You will still be in touch and comfort your friend. Even though you live in different states, these things might help your friend feel better, and your friendship could grow stronger.<sig>Frances, age 9, Georgia</sig>Send her a smile box, which is a box filled with things she loves&mdash;stuffed animals, photos, and so on. You can still help even when you&rsquo;re far away.<sig>Petra, age 10, Florida</sig>Ask to talk to one of your friend&rsquo;s parents. You could get some ideas about how to help her feel better. I had a really good friend from swim team, but she moved away. I don&rsquo;t know what to do, and I miss her a lot. In life, many people have situations like this, so maybe just show compassion for your friend, as any true friend would.<sig>Marissa, age 10, Illinois</sig>Even if you can&rsquo;t be with your friend, it doesn&rsquo;t mean that you can&rsquo;t show her you care. Send her a homemade gift or a card. You could try video chatting with her or sending her e-mails. However you choose to communicate, make sure that your friend knows that someone&mdash;you&mdash;is on her side.<sig>Abigail, age 11, Texas</sig>My friend and I had a big fight on the last day of school. I still want to be friends with her, but she&rsquo;s a stubborn kind of person, so I don&rsquo;t know what to do. Should I call her and apologize, or wait for her to apologize first?<sig>Friend Fight</sig><-----YSI-----><sub>What new fruit would you invent?</sub>Fruit-tastic!This question is from ten-year-old Havilah: &ldquo;If you could invent a new kind of fruit, what would you call it? What would it taste like? What would it look like?&rdquo;</sig>I would call my fruit a &ldquo;pleach.&rdquo; It would taste like a plum and a peach together.<sig>Sara, age 8, California</sig>I would make a fruit called &ldquo;dream-fruit.&rdquo; It would come in all different flavors, from chocolate to peppermint! It would be white and soft like a nectarine with red, pink, blue, and green spots.<sig>Jenna, age 9, Australia</sig>If I could invent a fruit, it would be called &ldquo;wowsaberry.&rdquo; It would taste different depending on which berry you picked. Some berries would be sour, others would be sweet, and some would even be salty. The fruit would look like squares with little triangular seeds all around them. They would be a nice light pink when they are ready to harvest.<sig>Heather, age 12, Pennsylvania</sig>I would invent a fruit call the &ldquo;tastyfruit.&rdquo; It would taste like whatever you wanted it to. For example, on a cold day, your tastyfruit would have a hot-chocolate flavor to warm you up. The fruit would also be immune to bugs, so no harmful chemicals would need to be sprayed on it.<sig>Madeleine, age 12, Kentucky</sig>&ldquo;Cantamelon&rdquo; would be a mix of cantaloupe and watermelon&mdash;my two favorite fruits.<sig>Kate, age 9, Texas</sig>I would call my new fruit &ldquo;tropizy&rdquo; because it would be tropical. It would taste like a cross between a pear and an orange. It would be yellow with fluorescent green stripes and would be long and wavy.<sig>Evelyn, age 10, Georgia</sig>If I could invent a new type of fruit, it would taste like a mix of raspberrries, strawberries, and dark chocolate, in the color pink. I would call the fruit &ldquo;chocoberries.&rdquo;<sig>Veronica, age 13, Illinois</sig>My two favorite fruits are raspberries and green apples, so my fruit would be the &ldquo;green rasapple!&rdquo; It would be sour with a touch of sweet&mdash;just like me!<sig>Shaniya, age 12, Mississippi</sig>The fruit I would create would be shaped like a plum, but it would be pink. Its flavor would be between a mango and a strawberry.<sig>An American Girl fan, age 10, Georgia</sig>I think I would invent a fruit that is a mix between a banana and an apple. Everyone would love ban-apples!<sig>Isabel, age 11, Florida</sig>If I could invent my own kind of fruit, I would call it a &ldquo;peapple&rdquo; because it would be a mix between a peach and an apple. It would be orange and red and taste so sweet.<sig>Lily, age 10, Mississippi</sig>I would call my fruit &ldquo;flowerberries.&rdquo; They would look like flowers and taste sweet but not too sweet&mdash;sort of like strawberries but different.<sig>Maddie, age 10, Arkansas</sig>If I could invent a new kind of fruit, it would be a combination of cherry and pear called &ldquo;cherrpear.&rdquo; It would be reddish green and taste so good.<sig>Talitha, age 11, Michigan</sig>I would invent a mix between a mango and a pomegranate called &ldquo;pomango.&rdquo;<sig>Jennie, age 11, Texas</sig>My new fruit would be called &ldquo;Hawaiian banana.&rdquo; It would be a banana with a red peel and would taste like coconut and pineapple.<sig>Emily, age 8, Maryland</sig>The &ldquo;fantastic strawingo&rdquo; would look like a giant lemon drop. It would have the texture of soft-serve ice cream, and it would taste like a really ripe mango mixed with a strawberry-kiwi smoothie. Yum!<sig>Iris, age 12, California</sig>Ah, Summertime!This question is from 12-year-old Isabelle: &ldquo;What do you love most about summer?&rdquo;<-----EFY-----><email>I love the Advice Library! When I visit your website right after school, I feel less tense.<sig>Rosy</sig><email>I play on this website almost every day! The best game for me is Pet Grooming Studio.<sig>An American Girl fan</sig>'; //Header('Content-type: text/xml'); $xml = new SimpleXMLElement('<update/>'); $string = $testing; //$_GET["cleanString"] || $testing; $sections = preg_split("/<-+\w+-+>/", $string); $postDate; if(count($sections) === 4){ makeINF($sections[0]); //$YSI = makeYSI($sections[1]); //$HFY = makeHFY($sections[2]); } else { print('NOPEe'); } function makeINF($INF){ $infoRegEx = '/[^:]*:\s*([^,]+,\s*\d+)[^:]*:\s(.*)/i'; $info = $xml->addChild('info'); $info->addAttribute('author', preg_replace($infoRegEx,'$2', $INF)); $info->addAttribute('postDate',preg_replace($infoRegEx,'$1', $INF)); print_r(preg_replace($infoRegEx,'$2', $INF)); } function makeYSI($YSI){ $returnYSI = createElement(''); } function makeHFY($HFY){ $returnHFY = createElement(''); } /* MainDoc = MainDoc.replace(/\n/ig,'') var sections = MainDoc.split(/<-+\w+-+>/) if(sections.length < 4) alert("sections didn't split correctly") var info = makeInfo(sections[0]) var HFY = makeHFY( sections[1]) var YSI = makeYSI( sections[2]) //var EFY = makeEFY( sections[3]) var docType = $('<?xml version="1.0" encoding="UTF-8"?>') var updateXML = $('<update/>').append(info).append(HFY).append(YSI) var mainMXL = $('<main>').append(docType).append(updateXML) trace(mainMXL.text) var finalXML = $("<textarea/>" ,{text:MainDoc,rows:"20"}) var Table = formTable() var Row1 = formRow("Final XML","This is the Quiz XML",mainMXL.innerHTML) $(Table).append(Row1) $("body").append(Table) */ //print_r($xml); echo $sxe->asXML(); //print($xml->asXML()); ?>
Output for 7.0.5 - 7.1.0
Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Uncaught Error: Call to a member function addChild() on null in /in/QlRfO:20 Stack trace: #0 /in/QlRfO(11): makeINF('Fun for Girls W...') #1 {main} thrown in /in/QlRfO on line 20
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Uncaught Error: Call to a member function addChild() on unknown in /in/QlRfO:20 Stack trace: #0 /in/QlRfO(11): makeINF('Fun for Girls W...') #1 {main} thrown in /in/QlRfO on line 20
Process exited with code 255.
Output for hhvm-3.12.0
Notice: Undefined variable: postDate in /in/QlRfO on line 8 Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function addChild() on a non-object (null)' in /in/QlRfO:20 Stack trace: #0 /in/QlRfO(11): makeINF() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.7 - 5.6.28
Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Call to a member function addChild() on null in /in/QlRfO on line 20
Process exited with code 255.
Output for 5.1.0 - 5.5.35
Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Call to a member function addChild() on a non-object in /in/QlRfO on line 20
Process exited with code 255.
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: postDate in /in/QlRfO on line 8 Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Call to a member function addChild() on a non-object in /in/QlRfO on line 20
Process exited with code 255.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: postDate in /in/QlRfO on line 8 Notice: Undefined variable: xml in /in/QlRfO on line 20 Fatal error: Call to a member function addChild() on a non-object in /in/QlRfO on line 20
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/QlRfO on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: simplexmlelement in /in/QlRfO on line 5