Write a PHP script to extract text (within parenthesis) from a string

  • برمجة بي اتش بي

Write a PHP script to extract text (within parenthesis) from a string.

Sample strings : 'The quick brown [fox].'

الأجوبة

<?php
$my_text = 'The quick brown [fox].';
preg_match('#\[(.*?)\]#', $my_text, $match);
print $match[1]."\n";
?>

Sample Output:

fox
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...