• Announcements

    • boen_robot

      Guidelines and Netiquette   03/28/2017

      Posting Problems:   Having problems posting your topic? Read through this: To join, you agree to our terms and conditions and fill out and submit a registration form. An activation email will be sent to your email adress, so you'll need to verify your account. After that the account has to be validated by one of the moderators. This will mean that it can take up to a day to be activated. A couple of things to remember to ensure approval: Don't use an email address in one of those $2 four character .com domains eg. xyds.com. These will be deleted and the domain added to the banned list. Don't use an email address that is within a domain with a bad reputation for spam. A Google search is run on every email address and email domain. Don't sign up with an email address that doesn't exist, doesn't work or requires the sender to answer a quiz before their email can get to you. Put your country and or state and city in the signup form. Blank forms will go to the botton of the "to do" list. And make sure that your email address and your country match, saying you're from Alabama and using a .ru email address is not going to get you activated. After a membership is activated the first few posts will be monitored. Posting spam or unapproved topics described in the agreement results in an immediate ban. The email provider and the IP addresses associated with the account will be banned and all posts will be deleted. These strict measures have been deemed necessary to hinder spam. Sorry for any inconvenience this causes, but it's not liable to change. If, after reading this, you still can't post and don't understand why, contact one of the Moderators listed here.   Topic Guidelines   Including the following information can expedite an accurate response from board members: Must be a Specific Problem or Question related to web design and development Include Code in Question (wrap with   for small blocks of code and for longer blocks   ) Include Code Author Include Extra Notes/Modifications/Attempts Include web link to page/file when possible Content Guidelines   You may not post, upload, link to, or email any Content that contains, promotes, gives instruction about, or provides prohibited Content. Prohibited Content includes any Content that breaks any local, state, county, national or international law. Prohibited Content also includes: No direct or indirect advertising or websites, forums, products, services No hijacking of posts (do not post your question in someone elses) Content that infringes upon any rights [ex. MP3s and ROMs] (including, but not limited to, copyrights and trademarks) Abusive, threatening, defamatory, racist, or obscene Viruses or any other harmful computer software False Information or libel Spam, chain letters, or Pyramid schemes Gambling or Illicit drugs Terrorism Hacking or cheating for internet/online games Warez, Roms, CD-Keys, Cracks, Passwords, or Serial Numbers Pornography, nudity, or sexual material of any kind Excessive profanity Invasive of privacy or impersonation of any person/entity Hacking materials or information Posting Tips   There are more BBcodes than there are buttons for on the reply menu. To get the full list, click "BB Code Help" underneath the clickable smilie face menu. Use   for small snippets of code Use   for lengthy snippets of code Use   if your snippet is HTML (optional) Use   if your snippet is SQL (optional) Rules of Conduct   Be nice. There's no need for calling someone stupid if they ask an 'easy' question. Keep your avatars and signatures absolutely child friendly. We have a younger audience on this forum. Keep your language appropriate for the same reason above. Do not PM moderators for help on the forum. Post on the topic, or create a new one.   Spam:   Recently, as you have all without doubt noticed, we have had lots of spam and advertisement on the forum. Therefore, we'd like to alert you as to what to do when you have found any of the aforementioned annoying messages: it. Immediately. Give a clear reason, please, if the advertising is not evident. DO NOT POST! Report, let the post stay as is, and we will get to it, meanwhile if you continue to post as normal in the other threads, it won't be on the top so long. Refrain from PMing the member. This won't help at all, as they are most likely spambots anyway. Thank you.       Images in signatures:   After thinking of users on dial-up, we have decided to enforce the following rules regarding signatures. Please pay heed to them. Respecting these rules is respecting the members on this forum with dial-up. Signature rules: No animated images AT ALL. No matter the amount of animation. Maximum image widthxheight: 300x150 Maximum image (file) size: 15kb Use calm colors. Do not use highly contrasting images in your signature, as this can get really annoying when seeing several posts from one member in the same thread. The same prohibited content goes for images as for posts. Lastly, use common sense. No lengthy signatures please. Save us some scrolling. Thank you.       Links in signatures:   Please understand that w3schools.com only exists because of voluntary work and is barely supported by the advertising littered throughout the tutorials and the forum. So, please, stop advertising other sites. DO not post links that drive traffic away from the w3schools domain - especially to a site that offers similar if not identical information. Please help support the site by keeping individuals on it. Thank you. Here are some guidelines as to what you can put in your signature: w3schools links --> allowed w3.org links --> allowed browser links --> allowed html editor links --> allowed personal sites --> allowed tutorial sites competing with w3schools --> NOT allowed sites completely irrelevant to webprogramming and this forum --> NOT allowed   Thanks for understanding, and for taking the time to read this. ~W3Schools Modstaff~
kaijim

PHP Tutorial

79 posts in this topic

Both are 'correct'. It just depends what you want to do. The first increments before echoing out to the page whereas the second increments after echoing out to the page.

Share this post


Link to post
Share on other sites

In case the tutorial is still being edited, here are my two cents...I know this has been mentioned before several times, but I really would like to see some Object Oriented PHP. The exclusion of it creates a big gap in the tutorial. And also a bit about regular expressions too.

Share this post


Link to post
Share on other sites

OOP is a worthwhile concept to discuss, if it is not already there. Meanwhile, look here.Regular expressions are not unique to PHP, so a discussion of them really does not belong in a PHP tutorial. There is some info in the JavaScript section, but an independent tutorial section addressing regex would be better.You might post both these remarks to the suggestions forum, which is, I think, the only forum the site admins ever visit on a regular basis. The other forums are mostly for users.

Edited by Deirdre's Dad

Share this post


Link to post
Share on other sites
Regular expressions are not unique to PHP, so a discussion of them really does not belong in a PHP tutorial. There is some info in the JavaScript section, but an independent tutorial section addressing regex would be better.
Something could be done with regex in the PHP tutorial similar to how SQL was included in the PHP tutorial. It could give a basic intro to RegEx and how to implement it within PHP. Then there could be a more in-depth standalone tutorial.

Share this post


Link to post
Share on other sites

Well, then I guess one php example would be string replacement, for a guestbook or forum, with example of how to detect bbcode sets, split it into three (opentag, data to format, endtag) and replace the opentag and endtag with < and > instead of [ and ].

Share this post


Link to post
Share on other sites

BBcode parseing is pretty much more complex than that because you have to deal with nested or unmatched tags.

Share this post


Link to post
Share on other sites
Not going to happen. It would be an enormous security threat to allow people to enter arbitrary server-side code for the server to execute. That goes for both PHP and ASP. There's no try-it editor for ASP code, either. Only client-side code. If you want to execute server-side code you need your own server (or space on someone else's). If you want to set up your own site to allow people to execute their own PHP code, fine, but don't expect your server to stay online very long.
A cool try-it might be a simple JavaScript based PHP interpreter one that can handle the basic functions, I mean if this is possible then why not? I'm just throwing in my two cents in case the owners read this I don't actually expect it but if it does happen then hats off.

Share this post


Link to post
Share on other sites

Here's a little try-out editor for phphttp://writecodeonline.com/php/ If you try typing in something like phpinfo() and you will see it has blocked any dangerous commands.

Share this post


Link to post
Share on other sites

That's fine for basic stuff, but the number of functions they have to disable means that it's not terribly useful. It is fine for basic things though.

Share this post


Link to post
Share on other sites

I'm actually working on a tool like that. You install it on your own system, so there are no limitations. I haven't released it yet because it lacks a few bells and whistles. But I've taken to using it all the time when I'm testing new code ideas, and also to solve problems that come up on this board. It's way faster than editing an actual document every time. Since I've been using it, my answers to PHP questions have gotten more thorough with a lot less work. Yay.

Share this post


Link to post
Share on other sites
I'm actually working on a tool like that. You install it on your own system, so there are no limitations. I haven't released it yet because it lacks a few bells and whistles. But I've taken to using it all the time when I'm testing new code ideas, and also to solve problems that come up on this board. It's way faster than editing an actual document every time. Since I've been using it, my answers to PHP questions have gotten more thorough with a lot less work. Yay.
gives you more time for stuff like this? :)http://w3schools.invisionzone.com/index.ph...mp;#entry217388 Edited by thescientist

Share this post


Link to post
Share on other sites

I also need time for my Lindsay Lohan Fan Club page. :)

Edited by Deirdre's Dad

Share this post


Link to post
Share on other sites

clearly... :)

Share this post


Link to post
Share on other sites
Here's a little try-out editor for phphttp://writecodeonline.com/php/If you try typing in something like phpinfo() and you will see it has blocked any dangerous commands.
That is a decent attempt but not very practical :) . If it were purely JavaScript based you could enable a lot more functions and worry less about server side security. Hmmm, a try-it editor browser plugin might be even cooler. I think I'll write that down.
I'm actually working on a tool like that. You install it on your own system, so there are no limitations. I haven't released it yet because it lacks a few bells and whistles. But I've taken to using it all the time when I'm testing new code ideas, and also to solve problems that come up on this board. It's way faster than editing an actual document every time. Since I've been using it, my answers to PHP questions have gotten more thorough with a lot less work. Yay.
That sounds cool DD what language are you writing it in? Edited by sansana

Share this post


Link to post
Share on other sites

Maybe I should have explained. The front end is HTML and AJAX. The back end is PHP. When you strip away all the safety features, error filtering, and a few other tweaks, the central function is -- wait for it -- eval.My goal wasn't to write a minimal PHP interpreter (cool, but not me) but to write a web-based PHP terminal. I wanted it to have access to all PHP features on my server, so it's no good as a W3Schools-type "try-it".OTOH, the way it speeds up workflow, I think it's a good learning tool. I built in ways to send get, post, cookie, and custom header data in addition to the code, so you can simulate just about everything. You can even look at the response headers.

Share this post


Link to post
Share on other sites
:) The forbidden eval. So it provides you with remote access allowing you to run scripts and you can condition the environment using various headers with the code? Thats pretty cool, I'm getting a picture similar to a JavaBean program I ran across once that provided you with a web based terminal and allowed you to execute java code.

Share this post


Link to post
Share on other sites

I am currently trying to learn php. i found the php tutorial to be helpful with simple concepts and getting the basics down, but in my opinion there should be more examples of practical applications of php in the tutorial. I think that would be very helpful.

Share this post


Link to post
Share on other sites

Even though I am a master in html and cms part of the web, I am still a newbie in php. So I searched your site, but failed to find enough information on php coding.I appreciate that the admin itself noticed it, waiting for much improved articles on php.

Edited by elizeb

Share this post


Link to post
Share on other sites
I don't know if it is an old idea or a new one, but is it possible to create a Try-it editor for PHP? Maybe eval() could be used for that, like eval($_POST['php_input']);Of cource with limitations :)
I am trying to create a comprehensive php e-learning environment for my honours project that will have a "try it yourself" editor. (limited of course). If you want to help me build the security and be part of my testing focus group, please see my forum page. http://w3schools.inv...l=&fromsearch=1 Edited by metallicrazy

Share this post


Link to post
Share on other sites

Reference for available short hand options!? for example

//longif(false == $something)//shortif(!$something)

//long if(1 < 2) {$result = true;} else {$result = false;} //short$result = (1 < 2) ? true : false;

I am suggesting this because this type of stuff really confused me when I was new and trying to learn from examples, often times the examples would write things in short hand. When you are new to programming anything foreign to you is very intimidating. This would be a great addition.

Edited by astralaaron

Share this post


Link to post
Share on other sites

I have one other idea from all of the posts about a "try it yourself editor" for PHP. I think that a major problem most people who are learning have is learning to debug their own syntax errors. It would be really cool (and I can't think why not possible) to make something similar to a try it editor but it is instead a crash course for debugging syntax errors. There could be general descriptions of the different possible errors, and then a generator that would write out a block of code with an error that the user would need to look through, identify the error, and correct it. The correct version could be stored into a session or something sort of like a Captcha to determine if they corrected the errors EDIT: It would also be very helpful if methods were shared as far as how a good programmer would work through their code to determine where an error is and how to identify the problem line.

Edited by astralaaron

Share this post


Link to post
Share on other sites

Instruction on debugging would be useful, a lot of people don't understand how to do it. It's a requirement for programming that a lot of people don't understand for some reason, but I'm not sure why. Most of how I debug is just what makes sense to me, rather than following a particular method. Syntax errors are obviously the easiest to debug, because it tells you right where the error is. Logic errors are harder to debug and usually require you to print out where the code is going and what the data is that it's working with so that you can figure out where the problem is.

1 person likes this

Share this post


Link to post
Share on other sites

Actually i comes over here when i want to learn php and i didn't know any thing about php. I have some little difficulty in learning php which is language, If you want to make little bit more efficient work to make your php side in different languages then this is one of the best place to learning every thing, well this is only suggestion if you like then thanks, Otherwise No problem do it as you know bettor

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now