Jump to content

PHP Tutorial


Recommended Posts

  • 11 months later...
  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

Hello everybody!We are currently trying to make the PHP part of the page better.We have taken a small break from writing the reference part (have made over 400 reference pages the last months), and we

A thing I certanly want to see is global variables handling, such as the GET variable. You know, the ones with which when you type "?VariableName=VariableValue" at the end of the URL to trigger specia

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

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
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.
Link to post
Share on other sites
  • 2 months later...

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 ].

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.
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.

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
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
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.

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.
Link to post
Share on other sites
  • 2 weeks later...
  • 4 months later...
  • 2 weeks later...

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
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
Link to post
Share on other sites
  • 1 month later...
  • 2 weeks later...

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
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
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.

  • Like 1
Link to post
Share on other sites
  • 2 weeks later...

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

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...