Search code examples
phpno-op

What would be a good noop for PhP


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?


Solution

  • 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