richardw Posted August 19, 2007 Share Posted August 19, 2007 Hello, I am seking feedback. I am going to be providing a one time class to PHP newbies. My goal is to go from NO knowledge to a first script and make it useful and set the spark for futher learning with PHP. Your fedback to any one of the folowing: 1. What were the most important functions to you in starting with PHP? 2. What did your first script have to accomplish? 3. What would you want a newbie to know? Thanks! and if I should move this to a different forum, please advise. Richard I will mark this post "SOLVED" within 48 hours Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/ Share on other sites More sharing options...
MadTechie Posted August 19, 2007 Share Posted August 19, 2007 Is this the correct section for this ? 1. print(); 2. that php was installed <?php phpinfo(); ?> 3. how to read the manual! Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-327989 Share on other sites More sharing options...
ToonMariner Posted August 19, 2007 Share Posted August 19, 2007 http://www.sitepoint.com/article/getting-started-mysql http://www.sitepoint.com/article/mysql-3-getting-started-php your first 2 hour class all written for you.......... Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328002 Share on other sites More sharing options...
richardw Posted August 19, 2007 Author Share Posted August 19, 2007 Thanks for the siteppoint link, I will add it to me resources handout. I was just hoping to get feedback suggestive of actual usage. Writing the class with examples will still be the fun part. I just want to make the most of limited time. Should I pull this thread or is there a better forum for this? Richard Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328005 Share on other sites More sharing options...
plutomed Posted August 19, 2007 Share Posted August 19, 2007 www.w3schools.com they have loads of languages there, that's where I learned it from Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328028 Share on other sites More sharing options...
keeB Posted August 19, 2007 Share Posted August 19, 2007 If it were me: 1. Quick rundown of apache/php5/mysql installation/configuration 2. print "Hello, World!"; 3. Echo Form 4. MySQL Chat / Tag board Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328033 Share on other sites More sharing options...
php_tom Posted August 19, 2007 Share Posted August 19, 2007 1. Quick rundown of apache/php5/mysql installation/configuration I don't think it's that important... most newbies use a remote host somewhere, not run their own server. And for development/testing, there's XAMPP which works out of the box. Besides, there's no way you would do this topic justice in three hours. www.w3schools.com they have loads of languages there, that's where I learned it from Haha! Me too... w3schools is great. I still go there all the time for HTML and CSS reference. My notes: I would go over the general language syntax, spend a bit of time on variable types, casting, etc. and then do a couple examples. Maybe how to send an email from a form. Or how to deal with a file upload. But I would leave at least a bit of time at the end to tell them some of the things PHP can do, but not how to do it. Smart people can google it, the most important thing is to know if something is possible or not. I'm thinking just briefly mention things like GD image lib, ezPDF lib, writing text/excel/whatever files from PHP, making a secure login area w/$_SESSION, search scripts, etc. Finally, make sure you point them to the following websites: 1) THIS WEBSITE: http://www.phpfreaks.com/forums/ 2) http://www.php.net -- Lots of stuff here, I use it mainly for the PHP function reference. 3) http://www.w3schools.com -- help for every web programming language you can think of. 4) http://sourceforge.net -- every time you think of a more complicated task/project, look here; it may have been done before. Use their search function and put "PHP" in your query. 5) Last but not least: http://www.google.com for solving almost any problem you ever have. Ack, this got long. Sry. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328065 Share on other sites More sharing options...
ToonMariner Posted August 19, 2007 Share Posted August 19, 2007 Keep it simple to begin with... I would simply go through that site point article. Get them to interact with data transferred to and from pages, and interact with the database. That will be more than enough for a starters class. By all means get into the nuts and bolts in subsequent classes bt diving in and doing an emailer while fun is not really going to let them grasp the fundamentals without distracting them - they will be foxused on the actual email rather than the data interaction IMO. Teaching the ins and outs of the functions and constructs of php should come later on... Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328075 Share on other sites More sharing options...
NArc0t1c Posted August 19, 2007 Share Posted August 19, 2007 I learned php the hard way, I was tossed into the deep side, I had two choices, either swim or sink. You're question with my answers: 1. What were the most important functions to you in starting with PHP? The session super global. 2. What did your first script have to accomplish? Be able to work after modifications. 3. What would you want a newbie to know? String's, learn it, We all still get people who asks these basic things. Read, http://php.net/string Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328096 Share on other sites More sharing options...
TheFilmGod Posted August 20, 2007 Share Posted August 20, 2007 I would teach them to use echo instead of print. Echo is better than print. It does the same thing while it can do a bit more. Not sure exactly what but that is what I read. You should teach them that php is server side language and compare it to javascript. Tell them a bit of history of it. LIke a quick two minute summarty. <?php ?> Then tell them how to save it on notepad as a .php file and put it up on server and test it. tell them the php fundamentals. Like echo and if else statments. These are not functions but built in key elements of php. Php-info () is important. isset () session_start () YOu can do a session example how to handle variables. When I first learned it I thought that was awesome!! Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328476 Share on other sites More sharing options...
neylitalo Posted August 20, 2007 Share Posted August 20, 2007 Echo is better than print. It does the same thing while it can do a bit more. Not sure exactly what but that is what I read. Here is a thorough description of print vs. echo, although I wouldn't say that echo can do more than print. They have their pros and cons, and there are situations where you would prefer one over the other. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-328579 Share on other sites More sharing options...
Azu Posted August 22, 2007 Share Posted August 22, 2007 You can use echo without surrounding stuff in (), thus saving time coding and disk space and a lil bit of CPU. "Print" is longer then "echo" thus takes longer to type and more disk space. Print (pointlessly) returns true, thus making print slower, where as echo just outposts the text. "Echo" sounds more cool and unique then "print", and rolls off the tongue better. Sure you can argue that the benefits aren't huge, but that doesn't change the fact. Is there any benefit to using print instead of echo? Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-330779 Share on other sites More sharing options...
MadTechie Posted August 22, 2007 Share Posted August 22, 2007 print() behaves like a function in that you can do: $ret = print "Hello World";And $ret will be 1That means that print can be used as part of a more complex expression where echo cannot Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-330786 Share on other sites More sharing options...
richardw Posted August 22, 2007 Author Share Posted August 22, 2007 Thanks Everyone! Richard Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-330902 Share on other sites More sharing options...
Azu Posted August 23, 2007 Share Posted August 23, 2007 print() behaves like a function in that you can do: $ret = print "Hello World";And $ret will be 1That means that print can be used as part of a more complex expression where echo cannot I could have sworn that I used $a=echo'Some text'; before and it worked.. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332329 Share on other sites More sharing options...
neylitalo Posted August 23, 2007 Share Posted August 23, 2007 Is there any benefit to using print instead of echo? Very simple conditional message output. I've used this in a few situations, usually for error messages. <?php // If some message hasn't already been displayed, then show it. If it hasn't, then don't show it. $displayed = $displayed ? $displayed : print("Some message."); ?> You can't do that with echo. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332372 Share on other sites More sharing options...
Daniel0 Posted August 23, 2007 Share Posted August 23, 2007 Is there any benefit to using print instead of echo? Very simple conditional message output. I've used this in a few situations, usually for error messages. <?php // If some message hasn't already been displayed, then show it. If it hasn't, then don't show it. $displayed = $displayed ? $displayed : print("Some message."); ?> You can't do that with echo. You can, but you need to change it a bit. <?php echo $displayed ? null : "Some message."; ?> Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332409 Share on other sites More sharing options...
neylitalo Posted August 23, 2007 Share Posted August 23, 2007 Very simple conditional message output. I've used this in a few situations, usually for error messages. <?php // If some message hasn't already been displayed, then show it. If it hasn't, then don't show it. $displayed = $displayed ? $displayed : print("Some message."); ?> You can't do that with echo. You can, but you need to change it a bit. <?php echo $displayed ? null : "Some message."; ?> Close, but not quite. Now that the message has been displayed, you need to adjust $displayed accordingly. I've used this in situations where I want a particular set of text to be shown once, and where there are multiple triggers. Once the text is shown, you don't want it shown again. How about something like this? <?php if($variable || print("Some message")) { //Execute some code here } ?> I can see this being useful in situations where you want the code to execute, but you want to show a warning or some other text when the first conditions weren't met. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332415 Share on other sites More sharing options...
Daniel0 Posted August 24, 2007 Share Posted August 24, 2007 Ah, I see... print returns true (well, actually it returns int 1, but that'll still evaluate to true) and therefore $displayed will hold the value of true. It will only be printed if $displayed is false. I forgot print returned a value, I can't remember ever having used it. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332762 Share on other sites More sharing options...
neylitalo Posted August 24, 2007 Share Posted August 24, 2007 Now, of course, neither of those situations where you might want to use print's return value are very common, nor are they very advantageous over any other ways of solving the same problem, but they are there. Quote Link to comment https://forums.phpfreaks.com/topic/65676-solved-most-important-php-functions-to-learn-in-3-hours/#findComment-332779 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.