Sometimes I do not want to do anything.
I just want to have a statement so I can put break point.
In c and objective-c we have while (false);
Say I want to break a function
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.navigationItem.leftBarButtonItem=nil;
self.navigationItem.rightBarButtonItem=nil;
[[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(updateDisplays) name: NotificationUpdateArroworLocation object:nil];
PO(self.tableView.indexPathForSelectedRow);
while(false);//I put break point here so program stop here.
}
In .net we have donothing (Not sure Did I make that up?).
What should we use in PhP?
You can use same trick and a lot of other features:
<?php
while (false);
// or empty output
echo '';
// or any expression without side effects
5 + 5;
If you use XDebug, you can call xdebug_break() function directly in any place.
Would
assert(true);
be enough to attach a breakpoint to?
For the dev environment, assertions should be compiled and executed. For the prod environment, assertions should probably not be compiled nor executed. So you can leave them in. Which is useful!
http://www.php.net/manual/en/function.assert.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With