View Full Version : PHP5!
Wow, I have started migrating some of my scripts over and decided to completely rebuild from the ground up, and I must say - I am in love the error handling, it is sooo good that I find myself overusing it :lol:...
How can you not love PHP5?...
<?php
class xmlException extends Exception {
function __construct() { //print_r($this); }
};
class xml extends DOMDocument {
public function __construct( ) {
parent::__construct();
}
public function loadFile($file) {
try {
self::fileExists($file);
parent::load($file);
return true;
} catch (xmlException $e) {
// File Not Found
return false;
}
}
public function saveFile($file) {
try {
self::fileDoesExist($file);
parent::save($file);
return true;
} catch (xmlException $e) {
// File Exists
return false;
}
}
private function fileExists($file) {
if (!file_exists($file)) throw new xmlException();
}
private function fileDoesExist($file) {
if (!file_exists($file)) throw new xmlException();
}
}
?>
edit:
Quiz,
I threw in 2 sneaky little syntax errors, try find it..
Velox
2nd July 2005, 01:21
*without turning, walks away very, very slowly*
*without turning, walks away very, very slowly*
Don’t you mean sacrifice a couple of virgins and a cow?
I also just realised that that base script is no good, so am starting again - still feel free to find the sneaky syntax errors, it will be fun :)
zadok
2nd July 2005, 02:14
No comment. :motu:
TwoSeven
2nd July 2005, 09:13
How can you not love PHP5?...
When you work in asp and asp.net :Punk:
**Leaves the room in silence. Comes back and throws milkshake at John :whistle:**
When you work in asp and asp.net :Punk:
BAH! EVIL EVIL EVIL EVIL...
I dab in asp but I just hate its database support...
Ixion
2nd July 2005, 18:28
BAH! EVIL EVIL EVIL EVIL...
I dab in asp but I just hate its database support...
Meh. Kiddy code. Join the dark side. Cobol and ABAP and C
Meh. Kiddy code. Join the dark side. Cobol and ABAP and C
Kiddy code? PHP?
Its just so many little kids throw an include() into there file and think that they can code, I think you would be surprised what PHP can do, C pisses me off, but then I dont have a decent debugger and studio.net is a faggort.
If I had visual C++ developer I would get into it more methinks
Coyote
2nd July 2005, 20:45
Wha? What is this language you speak of?
WINJA
2nd July 2005, 21:03
OGRE HATES NNNNEEEEEERRRDDDDSSSSS
OGRE HATES NNNNEEEEEERRRDDDDSSSSS
But nerds love you, gimmie love down there...
Ixion
2nd July 2005, 21:18
Kiddy code? PHP?
Its just so many little kids throw an include() into there file and think that they can code, I think you would be surprised what PHP can do, C pisses me off, but then I dont have a decent debugger and studio.net is a faggort.
If I had visual C++ developer I would get into it more methinks
Meh. get Vi from Here (http://www.vim.org/download.php) . What more you need ?
Gcc and gcc++ from Here (http://www.gnu.org/software/gcc/gcc.html)
and gdb debugger (none better) from same place
Cost = $0. Good sauce HP sauce, better source Open source.
TwoSeven
2nd July 2005, 21:42
BAH! EVIL EVIL EVIL EVIL...
I dab in asp but I just hate its database support...
Its pretty good now. .net is a bit obfusticated tho.
TwoSeven
2nd July 2005, 21:45
Meh. Kiddy code. Join the dark side. Cobol and ABAP and C
Thats cobol '77 you mean, - on punched card. Non of this airy fairy quiche eater stuff they use nowadays.
TwoSeven
2nd July 2005, 21:48
Wha? What is this language you speak of?
PHP stands for 'Pretty Hopeless Programmers'. Not a language as such, more of a script used to link someone elses code blocks together.
PHP stands for 'Pretty Hopeless Programmers'. Not a language as such, more of a script used to link someone elses code blocks together.
Well I make a rather tidy figure off building commercial level scripts....
NordieBoy
2nd July 2005, 23:12
Apache Rivet is the way to go ;)
Marmoot
3rd July 2005, 13:05
anybody know why ColdFusion is not so popular?
TwoSeven
3rd July 2005, 21:36
Its more popular amongst the corporates, but kind of losing ground to the standards based languages.
Pathos
4th July 2005, 01:16
I've never used php before but I'd hazard a guess that the } commented out and the missing ; from the end of the second class definition are your "fun" syntax errors.
Looks like its stolen most of its syntax/functionality from C++, which is a good thing in my opinion (no point reinventing the wheel). I've never liked exception handling in C++ but I think it works far better in php where I assume you have garbage collection and don't really care as much if the exception isn't caught.
I've never used php before but I'd hazard a guess that the } commented out and the missing ; from the end of the second class definition are your "fun" syntax errors.
Looks like its stolen most of its syntax/functionality from C++, which is a good thing in my opinion (no point reinventing the wheel). I've never liked exception handling in C++ but I think it works far better in php where I assume you have garbage collection and don't really care as much if the exception isn't caught.
very good :)..
You got the commented bracket..
But the sneaky one was with the end of the first class definition there is not suposed to be an ending ;
Yea, PHP is based strongly on C syntax which is good because it makes it accessible, and with PHP5 its introduced a much better OOP design..
have some rep :)
Pathos
4th July 2005, 01:41
But the sneaky one was with the end of the first class definition there is not suposed to be an ending ; bugger I assumed it would be like c++
I'm probably gonna do a little project with html+javascript+php+sql soon, I know html css javascript and sql but I've never put them together and internet programming is probably my greatess weakness. I should also do some java as well...so much to do so little time.
I'll probably cover it all in my papers next semester.
well in that respect my thoughts are, keep as much as you can server side where you can, blardy java nothing but trouble, If you need any help just PM me..
The pear library (http://pear.php.net) has some good tools that would most probably help you out!.
Marmoot
4th July 2005, 10:05
Its more popular amongst the corporates, but kind of losing ground to the standards based languages.
is it because coldfusion development is more expensive than ASP/PHP? (you know...server cost, hosting cost, etc)
I always use CF but I fear that there seems to be not much demand to CF people. Is this true, u think?
(I don't really know as I am not in IT business)
pyrocam
4th July 2005, 13:01
Meh. get Vi from Here (http://www.vim.org/download.php) . What more you need ?
Gcc and gcc++ from Here (http://www.gnu.org/software/gcc/gcc.html)
and gdb debugger (none better) from same place
Cost = $0. Good sauce HP sauce, better source Open source.
yeah man, everyone knows VI is the best editor. Ive still got a copy from my 1994 cd-rom install. (dont ask me what flavour I forget, they sold out ages ago)
although I have to say. even though it is the best editor. im lazy and editplus all my stuff. im re-doing pyrocam.com in notepad at the moment. looks pretty cool. (dont bother checking its not there atm)
edit: www.pyrocam.orcon.net.nz (http://www.pyrocam.orcon.net.nz)
testing server. links dont work
TwoSeven
4th July 2005, 13:24
is it because coldfusion development is more expensive than ASP/PHP? (you know...server cost, hosting cost, etc)
I always use CF but I fear that there seems to be not much demand to CF people. Is this true, u think?
(I don't really know as I am not in IT business)
Well the last big project I did that had CF developers was in 2000 and even then it was losing to either the ASP/MS guys or the Unix/Java camps depending on the investment by the company.
It was also brought by macromedia and to be honest, I dont really see it sitting in their product range, because they are now supporting .Net technologies.
I used to like it because it worked. However, I find myself more and more moving towards .Net now.
Marmoot
4th July 2005, 17:30
but CF is very easy to use and the way it handles strings and connects to the database is just plain simple, don't you think?
dhunt
4th July 2005, 18:11
Meh. get Vi from Here (http://www.vim.org/download.php) . What more you need ?
Gcc and gcc++ from Here (http://www.gnu.org/software/gcc/gcc.html)
and gdb debugger (none better) from same place
Cost = $0. Good sauce HP sauce, better source Open source.
You are on to it. :first: Why you are at it you might as well get a decent platform to build it on www.linux.org
I've done a bit of php and although it's not bad, I prefer perl for "hacking" stuff up in. But each to their own.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.