Jump to content

Hailwood

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

About Hailwood

  • Birthday 03/15/1991

Contact Methods

  • MSN
    hailwood@webspirited.com
  • Website URL
    http://www.webspirited.com

Profile Information

  • Gender
    Male
  • Location
    New Zealand

Hailwood's Achievements

Member

Member (2/5)

0

Reputation

  1. hi there im am making a php validation class with sub classes that extend it, eg, mobile, suburb, credit_card, ect so, the idea is you can call $validation = new Validation('mobile'); $valid = $validation->validate($number); $validation->type('suburb'); $valid2 = $validation->validate($suburb); now my idea for doing this is having class Validation { private $v_type = null; function __construct($type) { $this->type($type); } public function type($type) { $this->v_type = new $type(); } public function validate($info) { return $this->v_type->validate($info); } } as a very basic example but is there a better way of doing this?
  2. hi there, well here is what i am doing: $flybuys: 6014359000000928 $check: 8 $total = (array_sum($odds))+$evens; $total = str_split($total); $check = 10 - $total[1]; echo $flybuys.' % '.$check.': '.$flybuys % $check.'<br />'; $res = $flybuys % $check; echo 'res: '.$res; and the output is: 6014359000000928 % 8: 7 res: 7 yet if i do: echo 6014359000000928 % 8; i get: 0;, which is correct so where is the 7 coming from?
  3. and in a whole is entirely unhelpful :|
  4. These type of micro optimizations are generally a waste of time. maybe so, but i am doing optimization on the entire code, so i might as well.
  5. so basically here is a set of if statements that i am trying to optimize, can you please tell me if there are any differences in processing between them if($id!="0" && $status!="" && $msg_body=="") if($id != 0 && !empty($status) && empty($msg_body)) AND if($message_type == 0 && $msg_link_id != "0" && $status=="" && $msg_body!="") if($message_type == 0 && $msg_link_id != 0 && empty($status) && !empty($msg_body)) AND if($message_type == 0 && $msg_link_id=="0" && $status=="" && $msg_body!="") if($message_type == 0 && $msg_link_id == 0 && empty($status) && !empty($msg_body))
  6. just normal date time i.e 2010-07-01 22:42:21
  7. thorpe do you ever sleep? haha but yeah, i thought about doing that, except this table has over 300 columns (not designed nor can be changed by me) and so the query is is select * ... while($row = mysql_fetch-assoc...) { foreach($row as $k => $v ) $$k = $v; so i cant really do it in the query cheers. came across using strtotime on it before using date
  8. hi there, how should i go about formatting a mysql datetime with php? i have tried Date('jS M Y', $qry['msg_add_date']) but i simply get 1st Jan 1970
  9. hi guys so, can anyone tell me why i end up with different results with each of these <product_display_price> </product_display_price> = [product_display_price] => SimpleXMLElement Object ( [0] => ) <product_display_price>Ham $5.00</product_display_price> = [product_display_price] => Ham $5.00 <product_display_price/> = [product_display_price] => SimpleXMLElement Object ( ) all i did was $xml = simplexml_load_string($this->xml_data); echo '<pre>'; print_r($xml->xpath('/menu/products_list/product')); die('</pre>'); so, why does an empty element give me an empty object ^ expected a element with a string in it give me a string ^expected yet a element with a " " string gives me an object with a " " string in it ^not expected i would have expected it to act as either a string or an empty element
  10. damn, i think ill rather rewrite the app than use that on every include... thanks anyway
  11. see one way i could do it is to call $content = ob_get_contents(); ob_end_clean(); //replace stuff here echo $content; which would work fine, as i could just put ob_start before the echo $content; but is there a tidier way to do this? so the entire thing to replace would actually be $content = ob_get_contents(); $headers = array(); if ( !headers_sent() ) $headers = apache_response_headers(); ob_end_clean(); //replace stuff here ob_start(); if ( !empty( $headers ) ) foreach ( $headers as $name => $value ) header( "$name: $value" ); echo $content;
  12. then what would you suggest for when you have a default page layout i.e <html> <head> <!--stylsheets here --> <!--javascript here --> </head> <body> <!--header div --> <!-- menu div --> <?php include($_GET['page.php']; ?> <!-- footer div --> </body> and its not pratical for your site to include the header, footer, and menu divs from anther file now in the the include file you want to change the site title, and include another style sheet, so my idea was to have a placeholder variable in the head which i could edit. i am already calling ob_start() at the beginning of every every page so could i use that to edit it?
  13. Hi guys, if i have a variable (lets call it $page for now) and i echo it here (echo $page;) and i include a page here how in the included page can i edit the text that was echoed above?
  14. 8D yeah just saw that, so it means that the actual link that was being created was <a href="messaging"> which explains it. I think i kinda deserve anything you give me now lol.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.