Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix php codegen missing ?> at end of snippet (fixes #640) #724

Closed
wants to merge 1 commit into from
Closed

fix php codegen missing ?> at end of snippet (fixes #640) #724

wants to merge 1 commit into from

Conversation

aarifkhan7
Copy link

Fixes #640
Issue: The code generators for php, generates snippet without ?> end tag.

Code Snippet:
`<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://postman-echo.com/get?test=123',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
`

The Code snippet after the fix looks like:
`<?php

$curl = curl_init();

curl_setopt_array($curl, array(
CURLOPT_URL => 'https://postman-echo.com/get?test=123',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

?>`

@aman-v-singh
Copy link
Contributor

Hey @aarifkhan7,
It is entirely optional to close PHP with ?>, it is even considered a good practice to not close PHP tags.
You can read more about it here.

I am closing the PR, you can open it for further discussions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

PHP code generator does not end with ?>
2 participants